home *** CD-ROM | disk | FTP | other *** search
/ Risc World 7 / Risc World 7.iso / Software / Issue2 / PD / taufull.spk / !Tau_!RunImage (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  2006-06-14  |  124.9 KB  |  5,069 lines

  1.  This is Tau version 1.60
  2.  Copyright (C) 2001 Tim Birks
  3.  This program is free software; you can redistribute it and/or
  4.  modify it under the terms of the GNU General Public License
  5.  as published by the Free Software Foundation; either version 2
  6.  of the License, or (at your option) any later version.
  7.  This program is distributed in the hope that it will be useful,
  8.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.  GNU General Public License for more details.
  11.  You should have received a copy of the GNU General Public License
  12.  along with this program; if not, write to the Free Software
  13.  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  14.  Tim Birks
  15.  Email : pystab@hotmail.com
  16.  Current development by Peter Killworth
  17.  Email : p.killworth@soc.soton.ac.uk
  18.  Snail : National Oceanography Centre, Southampton
  19.          Empress Dock
  20.          Southampton
  21.          SO14 3ZH
  22.          United Kingdom.
  23. $+" at line ";
  24.  IFLEFT$(REPORT$,16)<>"ARM BBC BASIC V " THENERROR0,"Tau can only run on Basic V"
  25.  --- constants and array dimensions ---
  26. %maxC1%=64:room%=16*4096:minP1%=16
  27. C%=15:P%=4095
  28. !$C1%=C%+1:P1%=P%+1:maxC%=maxC1%-1
  29. "*fileversion$="150":workspacesize%=7804
  30. #@white%=&FFFFFF00:black%=&0:lgrey%=&DDDDDD00:mgrey%=&BBBBBB00
  31.  block% 3500, block1% 255, block2% 255, block3% 255, workspace0% workspacesize%
  32.  colourpick% 50, colourtitle% 50:colourhandle%=0
  33.  s%(60),g%(60)
  34.  ColumnPlot%(maxC%),ColumnMeaning$(maxC%),ColumnLine%(maxC%),ColumnThick(maxC%),ColumnDash(maxC%),ColumnGap(maxC%),ColumnFill%(maxC%),ColumnKeyText$(maxC%),workhorse%(maxC%)
  35.  ColumnPoints%(maxC%),ColumnChar%(maxC%),ColumnWidth(maxC%),ColumnHeight(maxC%),ColumnError%(maxC%),ColumnErrorThick(maxC%),ColumnErrorCap(maxC%),ColumnColour%(maxC%),drawn%(maxC%)
  36.  ColumnLinecol%(maxC%),ColumnCharcol%(maxC%)
  37.  ColumnLinestyle%(maxC%),ColumnDash2(maxC%)
  38.  ColumnX%(maxC%)
  39.  Data% 5*C1%*P1%,DataStatus% C1%*P1%
  40.  i%=0 
  41. C1%*P1%-4 
  42. 4:DataStatus%!i%=0:
  43.  Save$(5),FileType$(5),OldSave$(5)
  44.  groupheader%(3)
  45.  style$(2):style$(0)="
  46. ":style$(1)="
  47. ":style$(2)="
  48. defaultsavevars
  49. sel%=1<<21:grey%=1<<22
  50. 38leftwidth%=128:topheight%=80:ox%=0:x%=ox%+leftwidth%
  51.  --- initial values for variables ---
  52. 52quit%=
  53. :fileopen%=0:juststarted%=
  54. :mainopen%=
  55. 65caretcolumn%=0:caretrow%=0:maxcolumn%=0:maxrow%=0
  56. 77caret$="              ":caretoffset%=11:gotcaret%=
  57. 8/caretx1%=0:caretx2%=0:carety1%=0:carety2%=0
  58. 9(changed%=
  59. :TauFileName$="<Untitled>"
  60. importdrawfile%=
  61. defaultvars
  62.  --- initial actions ---
  63. loadDFMPicker:ViewOn%=
  64. :ViewLength%=0:ViewScale0=1:ViewScaleFactor=0.9:ViewUpdate%=
  65. setupsprites
  66.  stdum% 4
  67. !stdum%=0
  68. "Wimp_Initialise",310,&4B534154,"Tau",stdum% 
  69.  ,taskhandle%
  70. error1
  71. 23,255,255,255,255,255,255,255,255,255:fill$=
  72. templates
  73. definemenus
  74. iconbaricon
  75. opendatawindow:
  76. caretstring(-1)
  77.  juststarted% juststarted%=
  78. Tautoload 
  79. error
  80. J!MinSlotSize%=
  81. -&8000:Himem%=
  82. "Wimp_Poll",%110001,block% 
  83.  reason%
  84.  reason% 
  85.  user redraw of window
  86. !block%=viewhandle% 
  87. "Hourglass_On"
  88. S9  !block%=viewhandle%:
  89. "Wimp_GetWindowState",,block%
  90. T9  ViewMatrixScale%=ViewScale0*ViewScaleFactor*(1<<16)
  91. U+  !block1%=ViewMatrixScale%:block1%!4=0
  92. V-  block1%!8=0:block1%!12=ViewMatrixScale%
  93. WQ  block1%!16=256*((block%!4+block%!12) 
  94. 2 -ViewX%*ViewScale0*ViewScaleFactor)
  95. XQ  block1%!20=256*((block%!8+block%!16) 
  96. 2 -ViewY%*ViewScale0*ViewScaleFactor)
  97.  !block% <> colourhandle% 
  98. "Wimp_RedrawWindow",,block% 
  99.  flag%
  100.  flag%
  101. !block% 
  102.  columnhandle%:
  103. redrawcolumn
  104.  viewhandle%:
  105. redrawview
  106.  colourhandle%:
  107.  do nothing
  108. userdraw
  109. "Wimp_GetRectangle",,block% 
  110.  flag%
  111. !block%=viewhandle% 
  112. "Hourglass_Smash"
  113.  open window
  114.  !block% 
  115.  mainhandle%:
  116. datawindowmoved
  117.  colourhandle%:
  118.  ignore
  119. "Wimp_OpenWindow",,block%
  120.  close window
  121. !block%=mainhandle% 
  122.  ViewOn% 
  123. closewindow(viewhandle%):ViewOn%=
  124. "Wimp_SlotSize",MinSlotSize%,-1
  125.  changed% 
  126. Tjeopardy mainopen%=
  127.    mainopen%=
  128.  mainopen%=
  129. cleardata
  130. recordcaret(
  131. |"   
  132. closewindow(cornerhandle%)
  133. closewindow(tophandle%)
  134. ~    
  135. closewindow(lefthandle%)
  136. closewindow(mainhandle%)
  137. closewindow(columnhandle%)
  138. closewindow(framehandle%)
  139. closewindow(sizehandle%)
  140. closewindow(!block%)
  141. !block%=viewhandle% ViewOn%=
  142. "Wimp_SlotSize",MinSlotSize%,-1
  143.  mouse click
  144. N x%=!block%:y%=block%!4:button%=block%!8:window%=block%!12:icon%=block%!16
  145.  window%=mainhandle% 
  146. recordcaret(
  147.  button% 
  148.  menu clicked
  149.  window% 
  150.  mainhandle%,tophandle%,lefthandle%,cornerhandle%
  151. @   ?WarningItem%=(?WarningItem% 
  152. &FE) 
  153. (JeopardyWarning% 
  154. "Wimp_CreateMenu",,mainmenu%,x%-64,y%
  155. closewindow(columnhandle%):
  156. closewindow(framehandle%):
  157. closewindow(sizehandle%)
  158.    menutree$="main"
  159.  viewhandle%:
  160. 9   ?UpdateItem%=(?UpdateItem% 
  161. &FE) 
  162. (ViewUpdate% 
  163. "Wimp_CreateMenu",,viewmenu%,x%-64,y%
  164.    menutree$="view"
  165.  sizehandle%:
  166.  icon%=30 
  167.      ty$="keyfill"
  168. 9     
  169. opencolour("Key background colour",s%(30),30,1)
  170.  icon%=32 
  171.      ty$="keyborder"
  172. 5     
  173. opencolour("Key border colour",s%(32),32,1)
  174.  framehandle%:
  175.  icon%=13 
  176.      ty$="framefill"
  177. 5     
  178. opencolour("Background colour",s%(13),13,1)
  179.  icon%=14 
  180.      ty$="framecol"
  181. A     
  182. opencolour("Frame, labels and text colour",s%(14),14,1)
  183.  columnhandle%:
  184.  icon%=41 
  185.  icon%=43 
  186.  (icon%=15 
  187.  g%(15))
  188.  icon%=41 
  189.       ty$="colline"
  190. 0      
  191. opencolour("Line colour",s%(41),41,1)
  192.         
  193.  icon%=43 
  194.       ty$="colchar"
  195. 5      
  196. opencolour("Character colour",s%(43),43,1)
  197.         
  198.  icon%=15 
  199.       ty$="colfill"
  200. 0      
  201. opencolour("Fill colour",s%(15),15,1)
  202.         
  203.  icon%=47 
  204. "Wimp_CreateMenu",,stylemenu%,x%-64,y%
  205.    menutree$="styles"
  206. "Wimp_CreateMenu",,iconbarmenu%,x%-64,96+2*44
  207.    menutree$="iconbar"
  208.  adjust,select clicked (or double-clicked instead for mainhandle)
  209.  window% 
  210. opendatawindow:
  211. caretstring(-1)
  212.  mainhandle%:
  213.  button%=4 
  214. p    
  215. Tshift 
  216. highlight(0,maxcolumn%,caretrow%,caretrow%) 
  217. highlight(caretcolumn%,caretcolumn%,0,maxrow%)
  218. closewindow(columnhandle%):
  219. closewindow(framehandle%)
  220. closewindow(sizehandle%)
  221.  tophandle%:
  222. ;   !block1%=tophandle%:
  223. "Wimp_GetWindowState",,block1%
  224. S   dx%=(x%-block1%!4)+block1%!20 -8  : 
  225.  mousex - visiblearea-xmin + scrollx -8
  226. 7   dx1%=dx% 
  227.  (14*16)              : 
  228.  nr of column
  229. B   dx2%=dx% 
  230.  (14*16) 
  231.  16       : 
  232.  nr of char in this column
  233.  dx2% = 1 
  234. /     ColumnPlot%(dx1%)=
  235. (ColumnPlot%(dx1%))
  236. O     
  237. "Wimp_ForceRedraw",tophandle%,(dx1%*14*16),-44-36,((dx1%+1)*14*16),0
  238. Q     
  239.  caretcolumn%=dx1% 
  240. getvariables(columnhandle%) : 
  241.  update columnwindow
  242. a     
  243. changed(
  244. )                                    : 
  245.  update mainwindowtitle and (Auto)View
  246.  cornerhandle%:
  247. closewindow(columnhandle%):
  248. closewindow(framehandle%)
  249. closewindow(sizehandle%)
  250. view(0)
  251.  viewhandle%:
  252. Tshift 
  253. viewmouse(2) 
  254. viewmouse(button%)
  255.  columnhandle%:
  256.  icon%=41 
  257.  icon%=43 
  258.  icon%=15 
  259.  g%(15) 
  260.  icon%=41 
  261.       ty$="colline"
  262. 0      
  263. opencolour("Line colour",s%(41),41,1)
  264.         
  265.  icon%=43 
  266.       ty$="colchar"
  267. 5      
  268. opencolour("Character colour",s%(43),43,1)
  269.         
  270.  icon%=15 
  271.       ty$="colfill"
  272. 0      
  273. opencolour("Fill colour",s%(15),15,1)
  274.         
  275. '    
  276. selectvariables(window%,icon%)
  277.  icon%=1 
  278.  icon%=2 
  279. closewindow(columnhandle%):
  280. cancelOK
  281.  corrnhandle%:
  282.  icon%=1 
  283.  icon%=2 
  284. closewindow(corrnhandle%)   
  285.  edithandle%:
  286.  icon%=1 
  287. pkiedit
  288.  icon%=2 
  289. closewindow(edithandle%):
  290. "Wimp_CreateMenu",,-1
  291.  sizehandle%:
  292.  (icon%=30 
  293.  icon%=32) 
  294.  icon%=30 
  295.       ty$="keyfill"
  296. :      
  297. opencolour("Key background colour",s%(30),30,1)
  298.         
  299.  icon%=32 
  300.       ty$="keyborder"
  301. 6      
  302. opencolour("Key border colour",s%(32),32,1)
  303.         
  304. '    
  305. selectvariables(window%,icon%)
  306. >    
  307.  icon%=1 
  308. icon%=2 
  309. closewindow(sizehandle%):
  310. cancelOK
  311.  framehandle%:
  312.  (icon%=13 
  313.  s%(11)) 
  314.  icon%=14 
  315.  icon%=13 
  316.  s%(11) 
  317.       ty$="framefill"
  318. <      
  319. opencolour("Background frame colour",s%(13),13,1)
  320.         
  321.  icon%=14 
  322.      ty$="framecol"
  323. A     
  324. opencolour("Frame, labels and text colour",s%(14),14,1)
  325.         
  326. '    
  327. selectvariables(window%,icon%)
  328. ?    
  329.  icon%=1 
  330. icon%=2 
  331. closewindow(framehandle%):
  332. cancelOK
  333.  colourhandle%:
  334.  ignore
  335.  icon%=1 
  336. icon%=2 
  337. cancelOK
  338. '    
  339. selectvariables(window%,icon%)
  340. 16,64:
  341.  drag
  342.  window%=savehandle% 
  343. icon%=0 
  344. :   !block%=savehandle%:
  345. "Wimp_GetWindowState",,block%
  346. 3   x%=block%!4-block%!20:y%=block%!16-block%!24
  347. 3   block%!4=icon%:
  348. "Wimp_GetIconState",,block%
  349. Q   xmin%=x%+block%!8:ymin%=y%+block%!12:xmax%=x%+block%!16:ymax%=y%+block%!20
  350. P   block%!4=5:block%!8=xmin%:block%!12=ymin%:block%!16=xmax%:block%!20=ymax%
  351. F   block%!24=0:block%!28=0:block%!32=&7FFFFFFF:block%!36=&7FFFFFFF
  352. "Wimp_DragBox",,block%
  353. 256,1024:
  354.  click when double-click is active
  355.  window%=mainhandle% 
  356.    !block%=mainhandle%
  357. %&   
  358. "Wimp_GetWindowState",,block%
  359. &5   ox%=block%!4-block%!20:oy%=block%!16-block%!24
  360. 'H   column%=(x%-ox%-leftwidth%) 
  361. (14*16):row%=(oy%-y%-topheight%) 
  362. (6   
  363.  column%>C% column%=C% 
  364.  column%<0 column%=0
  365. )+   
  366.  row%>P% row%=P% 
  367.  row%<0 crow%=0
  368. *7   
  369. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  370.  button%=256 
  371. ,O    caretx1%=caretcolumn%:caretx2%=column%:carety1%=caretrow%:carety2%=row%
  372. -B    
  373.  caretx1%>caretx2% caretx2%=caretcolumn%:caretx1%=column%
  374. .<    
  375.  carety1%>carety2% carety2%=caretrow%:carety1%=row%
  376. caretstring(-1)
  377. 1J    caretx1%=column%:carety1%=row%:caretx2%=caretx1%:carety2%=carety1%
  378. 2+    caretcolumn%=column%:caretrow%=row%
  379. 35    
  380. caretstring(((x%-ox%-leftwidth%-8) 
  381. 57   
  382. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  383.  drag box
  384. "Wimp_GetPointerInfo",,block%:window%=block%!12
  385.  window% 
  386.  colourhandle%:
  387.  ignore this
  388. putsave
  389. ?,   Save$=Save$(SaveType%):i%=
  390. Save$,".")
  391.  i%>0
  392.     Save$=
  393. Save$,i%+1)
  394.     i%=
  395. Save$,".")
  396. DO   destx%=!block%:desty%=block%!4:desthandle%=block%!12:desticon%=block%!16
  397. E"   !block%=4*((49+
  398.  Save$) 
  399. FH   block%!12=0:block%!16=1:block%!20=desthandle%:block%!24=desticon%
  400. G9   block%!28=destx%:block%!32=desty%:block%!36=&10000
  401. H0   block%!40=
  402. ("&"+
  403. FileType$(SaveType%),3))
  404.    $(block%+44)=Save$+
  405. J;   
  406. "Wimp_SendMessage",18,block%,desthandle%,desticon%
  407.  key pressed
  408. N# key%=block%!24:window%=!block%
  409. !block%=mainhandle% 
  410. flush
  411.  key% 
  412.  &183: 
  413. S'   
  414.  "Wimp_GetPointerInfo",,block%
  415. T;   
  416. "Wimp_CreateMenu",,savehandle%,!block%-64,block%!4
  417.    SaveType%=0
  418. getsave
  419. WA   
  420. "Wimp_SetCaretPosition",savehandle%,3,0,0,-1,
  421. (Save$(0))
  422. &18E:
  423.  down arrow
  424. Yq   
  425.  caretrow%<P% 
  426. recordcaret(
  427. ):caretrow%+=1:
  428. oneselect(-1):
  429. getmaininfo:
  430.  caretrow%>brow%-2 
  431. scrollarea(1)
  432. &18F:
  433.  up arrow
  434. [p   
  435.  caretrow%>0 
  436. recordcaret(
  437. ):caretrow%-=1:
  438. oneselect(-1):
  439. getmaininfo:
  440.  caretrow%<trow%+2 
  441. scrollarea(2)
  442. &1AE:
  443.  CTRL-down
  444. ]A   
  445. recordcaret(
  446. ):caretrow%=P%:
  447. scrollarea(5):
  448. oneselect(-1)
  449. &1AF:
  450.  CTRL-up
  451. _@   
  452. recordcaret(
  453. ):caretrow%=0:
  454. scrollarea(6):
  455. oneselect(-1)
  456. &19C:
  457.  SHIFT-left
  458. getmaininfo:i%=-1
  459. b]   
  460.  caretx2%>caretcolumn% i%=caretx2%:caretx2%-=1 
  461.  caretx1%>0 caretx1%-=1:i%=caretx1%
  462. cR   
  463.  i%>-1 
  464. redrawmain(i%,i%,carety1%,carety2%):
  465.  i%<lcolumn%+1 
  466. scrollarea(4)
  467. &19D:
  468.  SHIFT-right
  469. getmaininfo:i%=-1
  470. f^   
  471.  caretx1%<caretcolumn% i%=caretx1%:caretx1%+=1 
  472.  caretx2%<C% caretx2%+=1:i%=caretx2%
  473. gR   
  474.  i%>-1 
  475. redrawmain(i%,i%,carety1%,carety2%):
  476.  i%>rcolumn%-1 
  477. scrollarea(3)
  478. &19E:
  479.  SHIFT-down
  480. getmaininfo:i%=-1
  481. j[   
  482.  carety1%<caretrow% i%=carety1%:carety1%+=1 
  483.  carety2%<P% carety2%+=1:i%=carety2%
  484. kO   
  485.  i%>-1 
  486. redrawmain(caretx1%,caretx2%,i%,i%):
  487.  i%>brow%-2 
  488. scrollarea(1)
  489. &19F:
  490.  SHIFT-up
  491. getmaininfo:i%=-1
  492. nZ   
  493.  carety2%>caretrow% i%=carety2%:carety2%-=1 
  494.  carety1%>0 carety1%-=1:i%=carety1%
  495. oO   
  496.  i%>-1 
  497. redrawmain(caretx1%,caretx2%,i%,i%):
  498.  i%<trow%+2 
  499. scrollarea(2)
  500. &18A:
  501. q*   
  502. recordcaret(
  503.  caretcolumn%<C% 
  504. r\    caretcolumn%+=1:
  505. oneselect(11):
  506. getmaininfo:
  507.  caretcolumn%>rcolumn%-1 
  508. scrollarea(3)
  509. tP    
  510.  caretrow%<P% caretcolumn%=0:caretrow%+=1:
  511. oneselect(11):
  512. scrollarea(9)
  513. &19A:
  514.  SHIFT-TAB
  515. w)   
  516. recordcaret(
  517.  caretcolumn%>0 
  518. x\    caretcolumn%-=1:
  519. oneselect(11):
  520. getmaininfo:
  521.  caretcolumn%<lcolumn%+1 
  522. scrollarea(4)
  523. zQ    
  524.  caretrow%>0 caretcolumn%=C%:caretrow%-=1:
  525. oneselect(11):
  526. scrollarea(10)
  527.  home
  528. }O   
  529. recordcaret(
  530. ):caretcolumn%=0:caretrow%=0:
  531. oneselect(11):
  532. scrollarea(7)
  533. &19B:
  534.  SHIFT-copy/end
  535. recordcaret(
  536. ):caretcolumn%=maxcolumn%:caretrow%=maxrow%:
  537. oneselect(11):
  538. scrollarea(8)
  539. &18D:
  540.  right arrow
  541.  caretoffset%<11 
  542. "    caretoffset%+=1:
  543. movecaret
  544. }    
  545.  caretcolumn%<C% 
  546. recordcaret(
  547. ):caretcolumn%+=1:
  548. oneselect(0):
  549. getmaininfo:
  550.  caretcolumn%>rcolumn%-1 
  551. scrollarea(3)
  552. &18C:
  553.  left arrow
  554.  caretoffset%>11-
  555.  caretshort$ 
  556. "    caretoffset%-=1:
  557. movecaret
  558. }    
  559.  caretcolumn%>0 
  560. recordcaret(
  561. ):caretcolumn%-=1:
  562. oneselect(11):
  563. getmaininfo:
  564.  caretcolumn%<lcolumn%+1 
  565. scrollarea(4)
  566.  backspace
  567. )   pos%=
  568.  caretshort$-11+caretoffset%
  569.  pos%>0 caretshort$=
  570. caretshort$,pos%-1)+
  571. caretshort$,pos%+1)
  572. 3   caret$=
  573. "             "+caretshort$+"  ",14)
  574. redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
  575.  return
  576. recordcaret(
  577. oneselect(11)
  578. Tshift 
  579.  caretcolumn%<C% 
  580. ]     caretcolumn%+=1:
  581. oneselect(11):
  582. getmaininfo:
  583.  caretcolumn%>rcolumn%-1 
  584. scrollarea(3)
  585.         
  586. Q     
  587.  caretrow%<P% caretcolumn%=0:caretrow%+=1:
  588. oneselect(11):
  589. scrollarea(9)
  590.         
  591. Tctrl 
  592. Q     
  593.  caretrow%<P% caretcolumn%=0:caretrow%+=1:
  594. oneselect(11):
  595. scrollarea(9)
  596.         
  597.  caretrow%<P% caretrow%+=1:
  598. oneselect(11):
  599. getmaininfo:
  600.  caretrow%>brow%-2 
  601. scrollarea(1)
  602.         
  603.  delete
  604. Tshift 
  605.  caretrow%<=maxrow% 
  606.      
  607. changed(
  608. :     
  609.  j%=caretx1% 
  610. caretx2%:
  611.  i%=caretrow% 
  612. maxrow%-1
  613. %     
  614. data(j%,i%,
  615. Tdata(j%,i%+1))
  616. <     DataStatus%?(j%+C1%*i%)=DataStatus%?(j%+C1%*(i%+1))
  617. +     
  618. :DataStatus%?(j%+C1%*maxrow%)=0:
  619. 9     maxrow%-=1:
  620. caretstring(11):
  621. update(mainhandle%)
  622.         
  623. *    pos%=
  624.  caretshort$-11+caretoffset%
  625. F    
  626.  pos%>0 caretshort$=
  627. caretshort$,pos%-1)+
  628. caretshort$,pos%+1)
  629. 4    caret$=
  630. "             "+caretshort$+"  ",14)
  631. B    
  632. redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
  633. &1CD:
  634.  insert
  635.  caretrow%<P% 
  636. caretrow%<=maxrow% 
  637. changed(
  638. ):maxrow%+=1
  639. =    
  640.  j%=caretx1% 
  641. caretx2%:
  642.  i%=maxrow% 
  643. caretrow%+1 
  644. $    
  645. data(j%,i%,
  646. Tdata(j%,i%-1))
  647. ;    DataStatus%?(j%+C1%*i%)=DataStatus%?(j%+C1%*(i%-1))
  648. ,    
  649. :DataStatus%?(j%+C1%*caretrow%)=0:
  650. E    caretrow%+=1:carety1%=caretrow%:carety2%=caretrow%:
  651. movecaret
  652. 7    
  653. getmaininfo:
  654.  caretrow%>brow%-2 
  655. scrollarea(1)
  656. update(mainhandle%)
  657.  CTRL-U
  658.  i%=caretx1% 
  659. caretx2%:
  660.  j%=carety1% 
  661. carety2%
  662. #   DataStatus%?(i%+C1%*j%)=0:
  663. caretstring(11):
  664. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  665. changed(
  666. maxcolumnrow
  667.  including valid characters
  668. "Mm0123456789.E- ",
  669.  key%)=0 
  670.      
  671. "Wimp_ProcessKey",key%
  672. *    pos%=
  673.  caretshort$-11+caretoffset%
  674. B    caretshort$=
  675. caretshort$,pos%)+
  676.  key%+
  677. caretshort$,pos%+1)
  678. 6    
  679.  caretshort$>10 caretshort$=
  680. caretshort$,2)
  681. 4    caret$=
  682. "             "+caretshort$+"  ",14)
  683. B    
  684. redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
  685.  window% 
  686.  colourhandle%:
  687.  do nothing
  688.  key% 
  689.  return
  690. #    button%=4:icon%=1:
  691. cancelOK
  692. "Wimp_ProcessKey",key%
  693.  menu selection
  694. "Wimp_GetPointerInfo",,block1%
  695. S x%=!block1%:y%=block1%!4:button%=block1%!8:window%=block1%!12:icon%=block1%!16
  696.  adjust%=(button%=1)
  697.  menutree$ 
  698.  "iconbar":
  699.  !block% 
  700.  quit selected
  701.  changed% 
  702.     quit%=
  703. Tjeopardy
  704.     quit%=
  705.  adjust% 
  706. "Wimp_CreateMenu",,iconbarmenu%
  707.  "view":
  708.  !block% 
  709.  redraw to default size
  710. 8   ViewScaleFactor=0.9:ViewX%=ViewX0%:ViewY%=ViewY0%
  711. "Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
  712.  replot graph
  713. view(0)
  714.  toggle auto-update flag
  715.    ViewUpdate%=
  716. ViewUpdate%
  717.  ViewUpdate% 
  718. view(0)
  719.  adjust% ?UpdateItem%=(?UpdateItem% 
  720. &FE) 
  721. (ViewUpdate% 
  722. "Wimp_CreateMenu",,viewmenu%
  723.  "styles":
  724. setthestyle(block%!0)
  725.  "main":
  726.  !block% 
  727.  paper, new for 1.50
  728.  block%!4=0 
  729. getvariables(sizehandle%):
  730. openwindow(sizehandle%)
  731.  graph, new for 1.50
  732.  block%!4=1 
  733. getvariables(framehandle%):
  734. openwindow(framehandle%)
  735.  Column
  736.  block%!4=0 
  737. getvariables(columnhandle%):
  738. openwindow(columnhandle%)
  739.  block%!4=3 
  740. calculate
  741.  block%!4=5 
  742. normalise
  743.  block%!4=6 
  744.  Save
  745.    SaveType%=block%!4
  746.  Cells
  747.  block%!4 
  748.  whole row
  749. 5     
  750. highlight(0,maxcolumn%,caretrow%,caretrow%)
  751.  whole column
  752. 8     
  753. highlight(caretcolumn%,caretcolumn%,0,maxrow%)
  754.  to top
  755.     :     
  756. highlight(caretcolumn%,caretcolumn%,0,caretrow%)
  757.  to bottom
  758. @     
  759. highlight(caretcolumn%,caretcolumn%,caretrow%,maxrow%)
  760.  all data
  761. +     
  762. highlight(0,maxcolumn%,0,maxrow%)
  763.  Reduce
  764.  block%!4 
  765.  Compact
  766. compact
  767.  Clear
  768.  changed% 
  769.       
  770. Tjeopardy 
  771. cleardata
  772.         
  773.      
  774. cleardata
  775.         
  776.  Warnings
  777. *    JeopardyWarning%=
  778. JeopardyWarning%
  779.  View
  780. view(0)
  781.  Multiple Xs
  782. &   !iMultipleX% = !iMultipleX% 
  783.      MultipleX% = 
  784.  MultipleX%
  785.  k,M, G labels
  786.    suffix%=
  787.  suffix%
  788.    !isuffix%=!isuffix% 
  789.  adjust% ?WarningItem%=(?WarningItem% 
  790. &FE) 
  791. (JeopardyWarning% 
  792. "Wimp_CreateMenu",,mainmenu%
  793. report("No such menu tree!")
  794.  lose caret
  795. window%=block%!0
  796.  window%<>colourhandle% 
  797. recordcaret(
  798.  gotcaret%=
  799.  gain caret
  800. window%=block%!0
  801.  window%<>colourhandle% gotcaret%=
  802. 17,18:
  803.  message system
  804.  block%!16 
  805.  quit
  806.   quit%=
  807.  pre-quit
  808.  changed% 
  809. Tjeopardy 
  810.     block%!12=block%!8
  811. <(    
  812. "Wimp_SendMessage",19,block%,0
  813. &400C9:
  814.  colour picker
  815.     block%!12=block%!8
  816. A(    
  817. "Wimp_SendMessage",19,block%,0
  818. &47700:
  819.  colour picked
  820.  ty$ 
  821.       
  822.  "colline":
  823.        s%(41)=block%!28
  824. F8       
  825. setcolour(columnhandle%,41,block%!28,"line")
  826.       
  827.  "colchar":
  828.        s%(43)=block%!28
  829. I8       
  830. setcolour(columnhandle%,43,block%!28,"char")
  831.       
  832.  "colfill":
  833.        s%(15)=block%!28
  834. L8       
  835. setcolour(columnhandle%,15,block%!28,"fill")
  836.       
  837.  "framefill":
  838.        s%(13)=block%!28
  839. O7       
  840. setcolour(framehandle%,13,block%!28,"fill")
  841.       
  842.  "framecol":
  843.        s%(14)=block%!28
  844. R7       
  845. setcolour(framehandle%,14,block%!28,"line")
  846.       
  847.  "keyfill":
  848.        s%(30)=block%!28
  849. U6       
  850. setcolour(sizehandle%,30,block%!28,"fill")
  851.       
  852.  "keyborder":
  853.        s%(32)=block%!28
  854. X6       
  855. setcolour(sizehandle%,32,block%!28,"line")
  856. Y        
  857. &47702:
  858.  close colour picker
  859. "ColourPicker_CloseDialogue",0,dialogue%
  860. &400C1:
  861.  mode change
  862. &400C0:
  863.  menu warning
  864. ^1  handle%=block%!20:x%=block%!24:y%=block%!28
  865.  handle%=savehandle% SaveType%=block%!36
  866. getvariables(handle%)
  867. "Wimp_CreateSubMenu",,handle%,x%,y%
  868.  DataLoad
  869. c-  file$=
  870. Tzeroterminatedstring(block%+44)
  871.   filetype%=block%!40
  872.  DataSaveAck
  873. g8  Save$(SaveType%)=
  874. Tzeroterminatedstring(block%+44)
  875.  now send a DataLoad message
  876. i$  block%!12=block%!8:block%!16=3
  877. "Wimp_SendMessage",18,block%,block%!4
  878. getsave
  879. update(savehandle%)
  880. "Wimp_CreateMenu",,-1
  881.  quit%
  882. "Wimp_CloseDown"
  883. data(col%,row%,val)
  884. w"|(Data%+5*col%+5*C1%*row%)=val
  885. Tdata(col%,row%)
  886. =|(Data%+5*col%+5*C1%*row%)
  887. loadDFMPicker
  888.  try to find the DrawFile and ColourPicker modules
  889. TpresentDFM 
  890. "XOS_Module",1,"<Tau$Dir>.DrawFile"
  891. TpresentPicker 
  892. "XOS_Module",1,"<Tau$Dir>.Picker"
  893. TpresentDFM
  894.  length%,flag%
  895. *Set TauDraw$Exists Yes
  896. 1*RMEnsure DrawFile 1.01 Set TauDraw$Exists No
  897. "XOS_ReadVarVal","TauDraw$Exists",block3%,255,0,0 
  898.  ,,length%
  899.  length%>255 =
  900. block3%?length%=13
  901. =($block3%="Yes")
  902. TpresentPicker
  903.  length%,flag%
  904. *Set TauPicker$Exists Yes
  905. 7*RMEnsure ColourPicker 0.39 Set TauPicker$Exists No
  906. "XOS_ReadVarVal","TauPicker$Exists",block3%,255,0,0 
  907.  ,,length%
  908.  length%>255 =
  909. block3%?length%=13
  910. =($block3%="Yes")
  911. error1:@%=&90A
  912. report("fatal error: "+
  913. $+" (line "+
  914. +")")
  915. "Wimp_CloseDown"
  916. error:@%=&90A
  917. report(
  918. $+" (line "+
  919. +")")
  920.  fileopen% 
  921. #fileopen%:fileopen%=0
  922. "OS_Byte",121,112 
  923. ,escpressed%
  924.  escpressed% 
  925. "Wimp_CloseDown":
  926. "Wimp_CreateMenu",,-1
  927.  ViewOn% 
  928. closewindow(viewhandle%):ViewOn%=
  929. "Wimp_SlotSize",MinSlotSize%,-1
  930. report(i$)
  931. #!block3%=255:$(block3%+4)=i$+
  932. "Wimp_ReportError",block3%,1,"Tau"
  933. Tjeopardy
  934. JeopardyWarning% 
  935. !block3%=255
  936. /$(block3%+4)="Data in jeopardy - proceed ?"
  937. "Wimp_ReportError",block3%,&13,"Tau" 
  938. ,response%
  939. =(response%=1)
  940. templates
  941. workspace%=workspace0%
  942. 'endwork%=workspace0%+workspacesize%
  943. "Wimp_OpenTemplate",,"<Tau$Dir>.Templates"
  944. )mainhandle%=
  945. Tgettemplate("DataMain")
  946. 'tophandle%=
  947. Tgettemplate("DataTop")
  948. )lefthandle%=
  949. Tgettemplate("DataLeft")
  950. ;X1%=block%!40:Y1%=block%!44:X2%=block%!48:Y2%=block%!52
  951. 'framehandle%=
  952. Tgettemplate("Frame")
  953. 'tickshandle%=
  954. Tgettemplate("Ticks")
  955. 'gridshandle%=
  956. Tgettemplate("Grids")
  957. )labelshandle%=
  958. Tgettemplate("Labels")
  959. %sizehandle%=
  960. Tgettemplate("Size")
  961. +scalinghandle%=
  962. Tgettemplate("Scaling")
  963. )columnhandle%=
  964. Tgettemplate("Column")
  965. %savehandle%=
  966. Tgettemplate("Save")
  967. %infohandle%=
  968. Tgettemplate("Info")
  969. /calculatehandle%=
  970. Tgettemplate("Calculate")
  971. +optionshandle%=
  972. Tgettemplate("Options")
  973. +bestfithandle%=
  974. Tgettemplate("BestFit")
  975. 'fontshandle%=
  976. Tgettemplate("Fonts")
  977. -cornerhandle%=
  978. Tgettemplate("DataCorner")
  979. -axistexthandle%=
  980. Tgettemplate("AxisText")
  981. +magnifyhandle%=
  982. Tgettemplate("Magnify")
  983. +meaninghandle%=
  984. Tgettemplate("Meaning")
  985. %weedhandle%=
  986. Tgettemplate("Weed")
  987. )importhandle%=
  988. Tgettemplate("Import")
  989. )downtohandle%=
  990. Tgettemplate("Downto")
  991. %manyhandle%=
  992. Tgettemplate("Many")
  993. /worksheethandle%=
  994. Tgettemplate("Worksheet")
  995. %viewhandle%=
  996. Tgettemplate("View")
  997. 'corrnhandle%=
  998. Tgettemplate("Corrn")
  999. %edithandle%=
  1000. Tgettemplate("Edit")
  1001. "Wimp_CloseTemplate"
  1002. !block%=mainhandle%
  1003. "Wimp_GetWindowInfo",,block%
  1004. titlebuffer%=block%!76
  1005. !block%=viewhandle%
  1006. "Wimp_GetWindowInfo",,block%
  1007. viewtitlebuffer%=block%!76
  1008. changed(
  1009. L!block1%=tophandle%:
  1010. "Wimp_GetWindowState",,block1%:topflag%=block1%!32
  1011. N!block2%=lefthandle%:
  1012. "Wimp_GetWindowState",,block2%:leftflag%=block2%!32
  1013. R!block3%=cornerhandle%:
  1014. "Wimp_GetWindowState",,block3%:cornerflag%=block3%!32
  1015. setextent
  1016. Tgettemplate(temp$)
  1017. $block2%=temp$
  1018. "Wimp_LoadTemplate",,block%,workspace%,endwork%,-1,block2%,0 
  1019. ,,workspace%
  1020.  temp$="Save" block%!112=1:
  1021.  special pleading !!!
  1022.  temp$ 
  1023.  "Column":
  1024. ,block%!64=spritearea%:
  1025.  point to sprites
  1026. $block%!(88+15*32+24)=spritearea%
  1027. $block%!(88+41*32+24)=spritearea%
  1028. $block%!(88+43*32+24)=spritearea%
  1029.  "Frame":
  1030. ,block%!64=spritearea%:
  1031.  point to sprites
  1032. $block%!(88+13*32+24)=spritearea%
  1033. $block%!(88+14*32+24)=spritearea%
  1034.  "Size":
  1035. ,block%!64=spritearea%:
  1036.  point to sprites
  1037. $block%!(88+30*32+24)=spritearea%
  1038. $block%!(88+32*32+24)=spritearea%
  1039. "Wimp_CreateWindow",,block% 
  1040.  handle%
  1041. =handle%
  1042. setextent
  1043.  assumes C% and P% (and C1% and P1%) are set to valid new values
  1044.  and that any data is cleared (with the user's agreement).
  1045. )!block%=0:block%!4=-topheight%-32*P1%
  1046. -block%!8=leftwidth%+14*16*C1%:block%!12=0
  1047. "Wimp_SetExtent",mainhandle%,block%
  1048. (block%!4=-32*P1%:block%!8=leftwidth%
  1049. "Wimp_SetExtent",lefthandle%,block%
  1050. +block%!4=-topheight%:block%!8=14*16*C1%
  1051. "Wimp_SetExtent",tophandle%,block%
  1052. !block%=mainhandle%
  1053. "Wimp_GetWindowState",,block%
  1054. datawindowmoved
  1055. changed(i%)
  1056.  x1%,x2%,y2%
  1057. changed%=i%
  1058.  changed% $titlebuffer%=TauFileName$+" *" 
  1059. $titlebuffer%=TauFileName$
  1060. !block%=mainhandle%
  1061. "Wimp_GetWindowState",,block%
  1062. ,x1%=block%!4:x2%=block%!12:y2%=block%!16
  1063. "Wimp_ForceRedraw",-1,x1%,y2%,x2%,y2%+44
  1064.  ViewOn% 
  1065. changed% 
  1066.  ViewUpdate% 
  1067. view(0) 
  1068. viewchanged(
  1069. viewchanged(i%)
  1070.  x1%,x2%,y2%
  1071.  i% $viewtitlebuffer%=TauFileName$+" (has been modified)" 
  1072. $viewtitlebuffer%=TauFileName$
  1073. !block%=viewhandle%
  1074. "Wimp_GetWindowState",,block%
  1075. ,x1%=block%!4:x2%=block%!12:y2%=block%!16
  1076. "Wimp_ForceRedraw",-1,x1%,y2%,x2%,y2%+44
  1077. opendatawindow
  1078. mainopen%=
  1079. openwindow(tophandle%)
  1080. openwindow(lefthandle%)
  1081. openwindow(cornerhandle%)
  1082. openwindow(mainhandle%)
  1083. !7!block%=mainhandle%:
  1084. "Wimp_GetWindowState",,block%
  1085. block%!28=-1
  1086. datawindowmoved
  1087. openwindow(handle%)
  1088. !block%=handle%
  1089. "Wimp_GetWindowState",,block%
  1090. "Wimp_OpenWindow",,block%
  1091. datawindowmoved
  1092.  reopenmain%
  1093. reopenmain%=
  1094. /8!block1%=tophandle%:
  1095. "Wimp_GetWindowState",,block1%
  1096. 0"new%=block%!28:old%=block1%!28
  1097.  new%<>old% reopenmain%=
  1098.  block%!28=cornerhandle%
  1099. "Wimp_OpenWindow",,block%
  1100. 3/!block2%=lefthandle%:!block3%=cornerhandle%
  1101. 4Gblock1%!4=block%!4+leftwidth%:block2%!4=block%!4:block3%!4=block%!4
  1102. 5Tblock1%!8=block%!16-topheight%:block2%!8=block%!8:block3%!8=block%!16-topheight%
  1103. 6Vblock1%!12=block%!12:block2%!12=block%!4+leftwidth%:block3%!12=block%!4+leftwidth%
  1104. 7Mblock1%!16=block%!16:block2%!16=block%!16-topheight%:block3%!16=block%!16
  1105. 82block1%!20=block%!20:block2%!20=0:block3%!20=0
  1106. 92block1%!24=0:block2%!24=block%!24:block3%!24=0
  1107. :Cblock1%!32=topflag%:block2%!32=leftflag%:block3%!32=cornerflag%
  1108. ;@block1%!28=new%:block2%!28=tophandle%:block3%!28=lefthandle%
  1109. "Wimp_OpenWindow",,block1%
  1110. "Wimp_OpenWindow",,block2%
  1111. "Wimp_OpenWindow",,block3%
  1112.  reopenmain% block%!28=cornerhandle%:
  1113. "Wimp_OpenWindow",,block%
  1114. closewindow(handle%)
  1115. !block%=handle%
  1116. "Wimp_CloseWindow",,block%
  1117. Tshift
  1118. "OS_Byte",202,0,255 
  1119. ,status%
  1120. =(status% 
  1121. Tctrl
  1122. "OS_Byte",202,0,255 
  1123. ,status%
  1124. =(status% 
  1125. maxcolumnrow
  1126.  j%,k%
  1127. QFk%=
  1128.  j%=0 
  1129. maxrow%:k%=k% 
  1130. (DataStatus%?(maxcolumn%+C1%*j%)<>0):
  1131. (maxcolumn%>0) 
  1132.  maxcolumn%-=1
  1133. TG k%=
  1134.  j%=0 
  1135. maxrow%:k%=k% 
  1136. (DataStatus%?(maxcolumn%+C1%*j%)<>0):
  1137. VFk%=
  1138.  j%=0 
  1139. maxcolumn%:k%=k% 
  1140. (DataStatus%?(j%+C1%*maxrow%)<>0):
  1141. (maxrow%>0) 
  1142.  maxrow%-=1
  1143. YG k%=
  1144.  j%=0 
  1145. maxcolumn%:k%=k% 
  1146. (DataStatus%?(j%+C1%*maxrow%)<>0):
  1147. getmaininfo
  1148. !block%=mainhandle%
  1149. "Wimp_GetWindowState",,block%
  1150. `2ox%=block%!4-block%!20:oy%=block%!16-block%!24
  1151. a9x1%=block%!4:x2%=block%!12:y1%=block%!8:y2%=block%!16
  1152. lcolumn%=(x1%-ox%) 
  1153. (16*14)
  1154. c*rcolumn%=(x2%-ox%-leftwidth%) 
  1155. (16*14)
  1156. trow%=(oy%-y2%) 
  1157. e"brow%=(oy%-y1%-topheight%) 
  1158. scrollarea(type%)
  1159.  change the main window's visible area in some way
  1160. !block%=mainhandle%
  1161. "Wimp_GetWindowState",,block%
  1162.  type% 
  1163. 1:block%!24=block%!24-32:
  1164.  scroll down
  1165. 2:block%!24=block%!24+32:
  1166.  scroll up
  1167. 3:block%!20=block%!20+16*14:
  1168.  scroll right
  1169. 4:block%!20=block%!20-16*14:
  1170.  scroll left
  1171. 5:block%!24=-32*P1%-topheight%:
  1172.  bottom
  1173. 6:block%!24=0:
  1174. 7:block%!24=0:block%!20=0:
  1175.  home
  1176. 8:block%!24=-32*(maxrow%+2)+(block%!16-block%!8)-topheight%:block%!20=16*14*(maxcolumn%+1)-(block%!12-block%!4)+leftwidth%:
  1177. 9:block%!24=block%!24-32:block%!20=0:
  1178.  beginning of next line
  1179. 10:block%!24=block%!24+32:block%!20=14*16*C1%+leftwidth%:
  1180.  end of last line
  1181.  block%!20<0 block%!20=0
  1182.  block%!20>14*16*C1%+leftwidth%-(block%!12-block%!4) block%!20=14*16*C1%+leftwidth%-(block%!12-block%!4)
  1183.  block%!24>0 block%!24=0
  1184.  block%!24<-32*P1%-topheight%+(block%!16-block%!8) block%!24=-32*P1%-topheight%+(block%!16-block%!8)
  1185. datawindowmoved
  1186. oneselect(co%)
  1187.  collapse the selected area to the caret cell only
  1188. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1189. +caretx1%=caretcolumn%:caretx2%=caretx1%
  1190. (carety1%=caretrow%:carety2%=carety1%
  1191. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1192. caretstring(co%)
  1193. caretstring(co%)
  1194.  define the caret variables for the caret cell, and put the caret there
  1195.  DataStatus%?(caretcolumn%+C1%*caretrow%) 
  1196.  move flag
  1197.  caretshort$="M"
  1198.  caretoffset%=11
  1199.  numerical value
  1200.  @%=&100060D
  1201. 2 caretshort$=
  1202. Tdata(caretcolumn%,caretrow%))
  1203.  co%>=0 caretoffset%=co%
  1204.  empty cell
  1205.  caretshort$=""
  1206.  caretoffset%=11
  1207. 255,"Bad DataStatus in PROCcaretstring"
  1208. 0caret$=
  1209. "             "+caretshort$+"  ",14)
  1210. movecaret
  1211. recordcaret(bigarea%)
  1212.  an edit of a cell has finished - record the result
  1213.  altered%,ds%,d,cs$
  1214.  flag, new DataStatus%, new Data, old caretshort$
  1215. altered%=
  1216. :ds%=1
  1217. caretshort$,"M") 
  1218. caretshort$,"m") ds%=2
  1219.  caretshort$=
  1220.  caretshort$," ") ds%=0
  1221.  caretshort$
  1222.  bigarea% 
  1223. 8 x1%=caretx1%:x2%=caretx2%:y1%=carety1%:y2%=carety2%
  1224. 3 x1%=caretcolumn%:x2%=x1%:y1%=caretrow%:y2%=y1%
  1225.  i%=x1% 
  1226.  j%=y1% 
  1227. $@%=&100060D:cs$=
  1228. Tdata(i%,j%))
  1229.  DataStatus%?(i%+C1%*j%)<>ds% 
  1230. (ds%=1 
  1231. cs$<>caretshort$) altered%=
  1232. data(i%,j%,d):DataStatus%?(i%+C1%*j%)=ds%
  1233.  altered% 
  1234.  caretx2%>maxcolumn% maxcolumn%=caretx2%
  1235.  carety2%>maxrow% maxrow%=carety2%
  1236. changed(
  1237. movecaret
  1238.  caretoffset%<11-
  1239.  caretshort$ caretoffset%=11-
  1240.  caretshort$ 
  1241.  caretoffset%>11 caretoffset%=11
  1242. mainopen% 
  1243. "Wimp_SetCaretPosition",mainhandle%,-1,caretcolumn%*16*14+16*(caretoffset%+1)+leftwidth%,-caretrow%*32-36-topheight%,&40B0028,-1
  1244. userdraw
  1245.  screen co-ords of lop left of visible area
  1246. *topleftx%=block%!4:toplefty%=block%!16
  1247.  offset of top left of visible area from work area origin
  1248. )scrollx%=block%!20:scrolly%=block%!24
  1249.  screen co-ords of redraw rectangle
  1250. ;x1%=block%!28:y1%=block%!32:x2%=block%!36:y2%=block%!40
  1251.  screen co-ords of work area origin
  1252. 7workx%=topleftx%-scrollx%:worky%=toplefty%-scrolly%
  1253.  distance, of top left corner of redraw rectangle, from work area origin
  1254. /rectworkx%=x1%-workx%:rectworky%=worky%-y2%
  1255.  !block% 
  1256.  mainhandle%:
  1257.  character positions from work area origin, start and max width
  1258. L startx%=(rectworkx%-leftwidth%) 
  1259. 16:starty%=(rectworky%-topheight%) 
  1260. 4 widthx%=1+(x2%-x1%) 
  1261. 16:widthy%=1+(y2%-y1%) 
  1262.  startx%<0 startx%=0
  1263.  starty%<0 starty%=0
  1264.  widthy%>P%-starty% widthy%=P%-starty%
  1265.  endy%=starty%+widthy%
  1266.  @%=&100060D
  1267.  startcolumn%=startx% 
  1268. H endcolumn%=startcolumn%+1+widthx% 
  1269.  endcolumn%>C% endcolumn%=C%
  1270.  i%=starty% 
  1271. endy%
  1272.  j%=startcolumn% 
  1273.  endcolumn%
  1274. K select%=(j%>=caretx1%) 
  1275. (j%<=caretx2%) 
  1276. (i%>=carety1%) 
  1277. (i%<=carety2%)
  1278.  select% 
  1279.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1280.  fill$;
  1281. "Wimp_SetColour",8
  1282.  i%=caretrow% 
  1283. j%=caretcolumn% 
  1284.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1285.  caret$;
  1286.  DataStatus%?(j%+C1%*i%)=1 
  1287.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1288. "             "+
  1289. Tdata(j%,i%))+"  ",14);
  1290.  DataStatus%?(j%+C1%*i%)=2 
  1291.  workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
  1292. "             M  ",14);
  1293.  select% 
  1294. "Wimp_SetColour",0
  1295.  lefthandle%:
  1296.  character positions from work area origin, start and max width
  1297.  starty%=rectworky% 
  1298.  widthy%=1+(y2%-y1%) 
  1299.  widthy%>P%-starty% widthy%=P%-starty%
  1300.  endy%=starty%+widthy%
  1301.  i%=starty% 
  1302. endy%
  1303. topleftx%+16,worky%-32*i%-4
  1304. "     "+
  1305. (i%),6)
  1306.  tophandle%:
  1307.  character positions from work area origin, start and max width
  1308.  i%=0 
  1309. workx%+14*16*i%+9*16+8,toplefty%-8
  1310.  i%,2)
  1311. workx%+14*16*i%+8*16+8,toplefty%-44
  1312. "  "+ColumnMeaning$(i%),3)
  1313.  print tick for plot/noplot and the selected pointmarker for each column
  1314.  dofont%=
  1315.  dofont%=
  1316.  dofont% 
  1317. "Font_FindFont",,FontsPoints$,16*12,16*12 
  1318.  fonthandle%
  1319.  Selwynhandle%=
  1320. TgetSelwyn
  1321.  i%=0 
  1322.  plot tick/cross in selwyn, otherwise +/-
  1323.  Selwynhandle% 
  1324. T     
  1325. "Font_CharBBox",Selwynhandle%,99+ColumnPlot%(i%),16 
  1326. ,bx1%,by1%,bx2%,by2%
  1327. %     
  1328. "Wimp_SetFontColours",,0,7
  1329. !     i$=
  1330. (99+ColumnPlot%(i%))
  1331. G     
  1332. "Font_Paint",,i$,16,workx%+14*16*i%+1*16+8,toplefty%-44-by2%
  1333. -     
  1334. workx%+14*16*i%+1*16+8,toplefty%-44
  1335. *     
  1336.  ColumnPlot%(i%) 
  1337.  "+" 
  1338.  plot pointmarker
  1339.  ColumnPlot%(i%) 
  1340.  dofont% 
  1341. ColumnMeaning$(i%),1)="Y" 
  1342.  ColumnPoints%(i%) 
  1343. O     
  1344. "Font_CharBBox",fonthandle%,ColumnChar%(i%),16 
  1345. ,bx1%,by1%,bx2%,by2%
  1346. %     
  1347. "Wimp_SetFontColours",,0,7
  1348.      i$=
  1349.  ColumnChar%(i%)
  1350. L     
  1351. "Font_Paint",,i$,16,workx%+14*16*i%+2*16+8+bx2%,toplefty%-44-by2%
  1352.  dofont% 
  1353. "Font_LoseFont",fonthandle%
  1354.  Selwynhandle% 
  1355. "Font_LoseFont",Selwynhandle%
  1356. 255,"Bad redraw request"
  1357. redrawmain(x1%,x2%,y1%,y2%)
  1358. Cxmin%=x1%*14*16-4+leftwidth%:xmax%=x2%*14*16+14*16+4+leftwidth%
  1359. :ymax%=-y1%*32+8-topheight%:ymin%=-y2%*32-40-topheight%
  1360. "Wimp_ForceRedraw",mainhandle%,xmin%,ymin%,xmax%,ymax%
  1361. update(handle%)
  1362. !block1%=handle%
  1363. "Wimp_GetWindowState",,block1%
  1364. $%xmin%=block1%!20:ymax%=block1%!24
  1365. %Exmax%=xmin%+block1%!12-block1%!4:ymin%=ymax%+block1%!8-block1%!16
  1366. "Wimp_ForceRedraw",handle%,xmin%,ymin%,xmax%,ymax%
  1367. highlight(x1%,x2%,y1%,y2%)
  1368. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1369. +7caretx1%=x1%:caretx2%=x2%:carety1%=y1%:carety2%=y2%
  1370. caretstring(((x%-ox%-leftwidth%-8) 
  1371. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  1372. flush
  1373. "OS_Byte",21,0
  1374. compact
  1375.  row%,status%,j%,count%,start%
  1376. "Hourglass_On"
  1377. maxcolumnrow
  1378. count%=0:start%=-1
  1379.  row%=0 
  1380. maxrow%
  1381.  status%=
  1382.  j%=0 
  1383. maxcolumn%
  1384.  DataStatus%?(j%+C1%*row%) status%=
  1385.  block%?row%=status%
  1386.  status%=
  1387.  count%+=1:
  1388.  start%=-1 start%=row%
  1389. docompact(count%,start%)
  1390. "Hourglass_Smash"
  1391. caretstring(11):
  1392. update(mainhandle%)
  1393. doweed
  1394.  i%,count%,start%,end%
  1395.  retain start% and then every WeedGap% until end% (keep end%)
  1396. maxcolumnrow
  1397. start%=0:end%=maxrow%
  1398.  WeedSelection% start%=carety1%:end%=carety2%
  1399.  end%>maxrow% end%=maxrow%
  1400.  WeedGap%<2 
  1401. end%-start%<2 
  1402. "Hourglass_On"
  1403.  i%=0 
  1404. start%:block%?i%=
  1405.  i%=end% 
  1406. maxrow%:block%?i%=
  1407. count%=0
  1408.  i%=start%+1 
  1409. end%-1
  1410. (i%-start%) 
  1411.  WeedGap%=0 block%?i%=
  1412.  block%?i%=
  1413. :count%+=1
  1414. docompact(count%,start%+1)
  1415. "Hourglass_Smash"
  1416. caretstring(11):
  1417. update(mainhandle%)
  1418. changed(
  1419. docompact(count%,start%)
  1420.  old%,row%,j%
  1421.  assumes block% is a table of which rows contain data
  1422.  with count% gaps, the first being row number start%
  1423.  count%=0 
  1424. old%=start%
  1425.  row%=start% 
  1426. maxrow%-count%
  1427.  block%?old%=
  1428.  old%+=1:
  1429.  row%<>old% 
  1430.  j%=0 
  1431. maxcolumn%
  1432. data(j%,row%,
  1433. Tdata(j%,old%))
  1434. f9  DataStatus%?(j%+C1%*row%)=DataStatus%?(j%+C1%*old%)
  1435.  old%+=1
  1436.  row%=maxrow%-count%+1 
  1437. maxrow%
  1438.  j%=0 
  1439. maxcolumn%
  1440. DataStatus%?(j%+C1%*row%)=0
  1441. maxrow%-=count%
  1442. maxcolumnrow
  1443. definemenus
  1444. papermenu%=
  1445. Tdefinemenu
  1446. stylemenu%=
  1447. Tdefinemenu
  1448. plotsmenu%=
  1449. Tdefinemenu
  1450. savemenu%=
  1451. Tdefinemenu
  1452. reducemenu%=
  1453. Tdefinemenu
  1454. cellsmenu%=
  1455. Tdefinemenu
  1456. mainmenu%=
  1457. Tdefinemenu
  1458. viewmenu%=
  1459. Tdefinemenu
  1460. iconbarmenu%=
  1461. Tdefinemenu
  1462.  colourmenu%=FNTdefinemenu
  1463. stylemenu%=
  1464. Tdefinemenu
  1465.  2,"Paper"
  1466.  0,-1,"Size..."
  1467.  &88,magnifyhandle%,"Magnify"
  1468.  8,"Graph"
  1469.  8,scalinghandle%,"Scaling"
  1470.  0,-1,"Frame..."
  1471.  8,tickshandle%,"Ticks"
  1472.  8,gridshandle%,"Grids"
  1473.  8,labelshandle%,"Labels"
  1474.  8,axistexthandle%,"Texts"
  1475.  8,fontshandle%,"Fonts"
  1476.  &88,worksheethandle%,"Worksheet"
  1477.  7,"Column"
  1478.  0,-1,"Plot..."
  1479.  8,meaninghandle%,"Meaning"
  1480.  8,manyhandle%,"Plot (many)"
  1481.  8,calculatehandle%,"Calculate"
  1482.  8,bestfithandle%,"Best fit"
  1483.  0,-1,"Normalise"
  1484.  &80,-1,"Sort"
  1485.  7,"Save"
  1486.  8,savehandle%,"Draw file F3"
  1487.  8,savehandle%,"Tau file"
  1488.  8,savehandle%,"Tau style"
  1489.  8,savehandle%,"CSV data"
  1490.  8,savehandle%,"Text data"
  1491.  8,savehandle%,"Binary data"
  1492.  &88,optionshandle%,"Options"
  1493.  4,"Reduce"
  1494.  8,weedhandle%,"Weed"
  1495.  0,-1,"Compact"
  1496.  0,-1,"Clear"
  1497.  &80,-1,"Warnings"
  1498.  6,"Cells"
  1499.  0,-1,"Whole row"
  1500.  0,-1,"Whole column"
  1501.  0,-1,"To top"
  1502.  0,-1,"To bottom"
  1503.  8,downtohandle%,"Down to"
  1504.  &80,-1,"All data"
  1505.  11,"Main"
  1506.  0,papermenu%,"Paper"
  1507.  0,stylemenu%,"Graph"
  1508.  0,plotsmenu%,"Column"
  1509.  0,savemenu%,"Save"
  1510.  8,importhandle%,"Import"
  1511.  0,cellsmenu%,"Cells"
  1512.  0,reducemenu%,"Reduce"
  1513.  0,-1,"View"
  1514.  0,-1,"Many Xs"
  1515.  0,-1,"k,M,G labels"
  1516.  &80,edithandle%,"Global Edit"
  1517.  3,"View"
  1518.  0,-1,"Zoom to fit"
  1519.  0,-1,"Re-plot"
  1520.  &80,-1,"Auto-update"
  1521.  2,"Tau"
  1522.  8,infohandle%,"Info"
  1523.  128,-1,"Quit"
  1524.  flags,submenu,entry
  1525.  3,"Line styles"
  1526.  0,-1,"
  1527.  0,-1,"
  1528.  &80,-1,"
  1529. Tdefinemenu
  1530.  m%,p%,fg%
  1531.  m% 28+24*n%
  1532. *m%!12=&70207:m%!20=44:m%!24=0:width%=0
  1533. i%=m%+28:p%=-1
  1534.  f%,i%!4,i$
  1535.  i$="Warnings" WarningItem%=i%
  1536.  i$="Auto-update" UpdateItem%=i%
  1537.  PDK Multiple X addition
  1538.  i$="Many Xs" 
  1539. iMultipleX%=i%
  1540.  MultipleX% f%=(f% 
  1541.  PDK suffix addition
  1542.  i$="k,M,G labels" 
  1543. isuffix%=i%
  1544.  suffix% f%=(f% 
  1545. $!i%=f%:i%!8=&7000021:$(i%+12)=i$
  1546.  i$>width% width%=
  1547. i%+=24
  1548. m%!16=(1+width%)*16
  1549. iconbaricon
  1550. >!block%=-1:block%!4=0:block%!8=0:block%!12=68:block%!16=68
  1551. 'block%!20=&3002:$(block%+24)="!tau"
  1552. "Wimp_CreateIcon",,block% 
  1553.  iconbariconhandle%
  1554. Tzeroterminatedstring(m%)
  1555. i$="":i%=?m%
  1556.  i%<>0
  1557. m%+=1:i%=?m%
  1558. Tcheckfont(font$)
  1559.  find%,i$,b%,i%
  1560. i%=0 : 
  1561.  b% 256
  1562. font$=
  1563. Tlowercase(font$)
  1564. find%=
  1565.  "Font_ListFonts",,b%,i%,-1 
  1566.  ,,i%
  1567.  i$=$b%
  1568. Tlowercase(i$)
  1569.  font$=i$ find%=
  1570.  find% 
  1571.  i%=-1
  1572. =find%
  1573. Tlowercase(i$)
  1574.  i%,j%
  1575.  i$=0 =i$
  1576.  i%=1 
  1577. i$,i%,1)
  1578.  j%>=
  1579. i$,i%,1)=
  1580. view(length%)
  1581. TpresentDFM 
  1582.  importdrawfile%=
  1583.  ViewOn% 
  1584. closewindow(viewhandle%):ViewOn%=
  1585. "Wimp_SlotSize",MinSlotSize%,-1
  1586. report("Cannot view the graph: the DrawFile module is absent"):
  1587.  **** to avoid possible sillies before any scaling
  1588.  ScalingAuto% 
  1589. autoscale
  1590. "Hourglass_On"
  1591.  length% ViewLength%=length% 
  1592.  ViewLength%=
  1593. Tgenerate(
  1594.  ViewLength% 
  1595. "DrawFile_BBox",0,Himem%,ViewLength%,0,block2%
  1596. ) ViewWidth%=(block2%!8-!block2%) 
  1597. , ViewHeight%=(block2%!12-block2%!4) 
  1598. J ViewScale0=ViewWidth%:
  1599.  ViewHeight%>ViewWidth% ViewScale0=ViewHeight%
  1600.  ViewScale0=1280/ViewScale0
  1601. J ViewX0%=(block2%!8+!block2%) 
  1602. 512:ViewY0%=(block2%!12+block2%!4) 
  1603. (ViewScaleFactor>0.8 
  1604. ViewScaleFactor<1) 
  1605. ViewOn% ViewScaleFactor=0.9:ViewX%=ViewX0%:ViewY%=ViewY0%
  1606.  !block%=viewhandle%
  1607. "Wimp_GetWindowState",,block%
  1608. "- block%!12=block%!4+ViewScale0*ViewWidth%
  1609. #. block%!8=block%!16-ViewScale0*ViewHeight%
  1610.  block%!28=-1
  1611. "Wimp_OpenWindow",,block%
  1612. "Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
  1613.  ViewOn%=
  1614. viewchanged(
  1615.  ViewOn% 
  1616. closewindow(viewhandle%):ViewOn%=
  1617. "Wimp_SlotSize",MinSlotSize%,-1
  1618. report("There is not enough free memory to view the graph")
  1619. "Hourglass_Smash"
  1620. redrawview
  1621. TpresentDFM 
  1622. "DrawFile_Render",0,Himem%,ViewLength%,block1%,block%+28,0
  1623. viewmouse(button%)
  1624. !block%=viewhandle%
  1625. "Wimp_GetWindowState",,block%
  1626. 8EViewX%+=(x%-(block%!4+block%!12) 
  1627. 2)/(ViewScale0*ViewScaleFactor)
  1628. 9EViewY%+=(y%-(block%!8+block%!16) 
  1629. 2)/(ViewScale0*ViewScaleFactor)
  1630.  button%=4 ViewScaleFactor=ViewScaleFactor*2
  1631.  button%=1 ViewScaleFactor=ViewScaleFactor/2
  1632. "Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
  1633.  ##### file operations, loading, saving, etc #####
  1634. cleardata
  1635.  i%=0 
  1636. C1%*P1%-4 
  1637. 4:DataStatus%!i%=0:
  1638. maxcolumn%=0:maxrow%=0
  1639. caretcolumn%=0:caretrow%=0
  1640. oneselect(11)
  1641. update(mainhandle%)
  1642. changed(
  1643. changed(
  1644. Tautoload
  1645.  r$,i%,object%,load%
  1646. "OS_GetEnv" 
  1647. M%i%=
  1648. r$,"!RunImage"):r$=
  1649. r$,i%+10)
  1650. r$,"0")
  1651.  i%<>0 
  1652.  filetype%=
  1653. ("&"+
  1654. r$,i%,3))
  1655.  file$=
  1656. r$,i%+3)
  1657. file$="<Tau$Dir>.Default"
  1658. "OS_File",17,file$ 
  1659.  object%,,load%
  1660. filetype%=(load%>>8) 
  1661. (filetype%=&82 
  1662. filetype%=&83) 
  1663. object%=1 =
  1664.  filetype%=&FFB 
  1665.  file$:
  1666.  BASIC file
  1667.  filetype%=&AFF importdrawfile%=
  1668. view(0):
  1669.  drawfile
  1670.  changed% 
  1671. filetype%<>&83 
  1672.  filetype%=&82 
  1673. (caretrow%<=maxrow% 
  1674. caretcolumn%<=maxcolumn%) 
  1675. Tjeopardy 
  1676. "Hourglass_On"
  1677.  ViewOn% 
  1678. closewindow(viewhandle%):ViewOn%=
  1679. "Wimp_SlotSize",MinSlotSize%,-1
  1680. d$rw0%=caretrow%:cl0%=caretcolumn%
  1681. (file$):fileopen%=c%
  1682.  filetype% 
  1683. &1000,&2000:
  1684.  directory or application
  1685.  TauFile
  1686. Tloadvars 
  1687. loadtaudata:
  1688. changed(
  1689. checkscaling:
  1690.  file$<>"<Tau$Dir>.Default" Save$(1)=file$:TauFileName$=
  1691. Tleafname(file$)
  1692.  TauStyle
  1693. Tloadvars 
  1694. checkscaling:
  1695.  file$<>"<Tau$Dir>.Default" Save$(2)=file$
  1696. &DFE:
  1697. loaddata:Save$(3)=file$:
  1698. changed(
  1699. &FFF:
  1700.  Text
  1701. loaddata:Save$(4)=file$:
  1702. changed(
  1703.  any other file type (including &FE4 "DOS" and &FFD "Data")
  1704. #c%=0
  1705.  i%=&40 
  1706. i%=&80 
  1707. i%=&88 
  1708.  assume this is a BASIC data file
  1709. loaddatadata:Save$(5)=file$
  1710. loaddata
  1711. changed(
  1712. #c%:fileopen%=0
  1713.  filetype%=&82 
  1714. filetype%=&83 
  1715. Tcheckfont(FontsPoints$) 
  1716. report("Warning: the font for data points is absent!")
  1717. Tcheckfont(FontsLabels$) 
  1718. report("Warning: the font for graph labels is absent!")
  1719.  ScalingAuto% 
  1720. autoscale
  1721.  mainopen% 
  1722. update(tophandle%)
  1723. update(mainhandle%):
  1724. caretstring(-1)
  1725. opendatawindow:
  1726. caretstring(-1)
  1727. "Hourglass_Smash"
  1728. loadtaudata
  1729. #c%,maxcolumn%,maxrow%
  1730.  maxrow%>P% maxrow%=P%:
  1731. report("Big file: some rows of data will not be imported!")
  1732.  i%=0 
  1733. C1%*P1%-4 
  1734. 4:DataStatus%!i%=0:
  1735.  rw%=0 
  1736. maxrow%
  1737.  cl%=0 
  1738. maxcolumn%
  1739. #c%,d
  1740. data(cl%,rw%,d)
  1741. "DataStatus%?(cl%+C1%*rw%)=
  1742. loadweedwarn
  1743. =loadweed%=(ImportGap%<>1) 
  1744. (ImportRow%>0) 
  1745. (ImportCol%>0)
  1746.  JeopardyWarning% 
  1747. loadweed% 
  1748. report("Imported data will be weeded!")
  1749. loaddata
  1750.  a place filled with just "." has status "empty" but reserves a space
  1751.  a place filled with "M" marks a move rather than a draw plot action
  1752. loadweedwarn
  1753. /rw%=caretrow%-1:cl%=caretcolumn%-ImportCol%
  1754. skiprows%=ImportRow%
  1755.  rows
  1756.  skip rows, with next byte ready in b%
  1757.  i%=skiprows%
  1758.  i%>0
  1759.  b%<>13 
  1760. b%<>10 
  1761. #c%:b%=
  1762. (b%=13 
  1763. b%=10) 
  1764. #c%:b%=
  1765.   i%-=1
  1766.  skiprows%=ImportGap%-1
  1767. #c% rw%+=1:cl%=caretcolumn%-ImportCol%
  1768.  columns
  1769.  get the next datum
  1770.  anything not numerical, space, CR or LF is treated like a comma
  1771.  b%=32 
  1772. #c%:b%=
  1773. 1  i$="":b$=
  1774.  b%:n%=
  1775. "0123456789.EeDd+-Mm",b$)
  1776.    i$+=b$
  1777. 5    b%=
  1778. #c%:b$=
  1779.  b%:n%=
  1780. "0123456789.EeDd+-Mm",b$)
  1781.     n%=0
  1782.  accept the datum if it hasn't been weeded
  1783.  cl%>=caretcolumn% 
  1784. (i$<>"" 
  1785. #c%) 
  1786. cl%<=C% 
  1787. rw%<=P% 
  1788. #   i%=
  1789. i$,"e"):
  1790. i$,i%)="E"
  1791. #   i%=
  1792. i$,"D"):
  1793. i$,i%)="E"
  1794. #   i%=
  1795. i$,"d"):
  1796. i$,i%)="E"
  1797. 6   i%=
  1798. i$,"E"):
  1799.  i% i$=
  1800. i$,i%-1)+"E"+
  1801. i$,i%+1)
  1802. data(cl%,rw%,
  1803. ,    
  1804.  ".","":DataStatus%?(cl%+C1%*rw%)=0
  1805. -    
  1806.  "M","m":DataStatus%?(cl%+C1%*rw%)=2
  1807. %    
  1808. :DataStatus%?(cl%+C1%*rw%)=1
  1809.  cl%>maxcolumn% maxcolumn%=cl%
  1810.  rw%>maxrow% maxrow%=rw%
  1811.   cl%+=1
  1812.  get the next bit of filling
  1813.  b%<>13 
  1814. b%<>10 
  1815. #c% b%=
  1816.  next column
  1817.  no more columns, next row
  1818. (b%=13 
  1819. b%=10) 
  1820. #c%:b%=
  1821. rw%>P%
  1822. loaddatadata
  1823.  ImportGet% 
  1824. #c%,cls% 
  1825.  cls%=ImportNumber%
  1826.  cls%<=ImportCol% 
  1827. report("all columns are weeded!")
  1828. loadweedwarn
  1829. $rw%=caretrow%-1:cl%=caretcolumn%
  1830. skiprows%=ImportRow%
  1831.  skiprows% 
  1832.  i%=1 
  1833. cls%*skiprows%
  1834. #c%,I
  1835.  skiprows%=ImportGap%-1
  1836. #c% rw%+=1
  1837.  ImportCol% 
  1838.  i%=1 
  1839. ImportCol%
  1840. #c%,I
  1841.  cl%=caretcolumn% 
  1842. caretcolumn%+cls%-1-ImportCol%
  1843. #c%,I
  1844.  cl%<=C% 
  1845. rw%<=P% 
  1846. data(cl%,rw%,I):DataStatus%?(cl%+C1%*rw%)=1
  1847.  rw%>maxrow% maxrow%=rw%
  1848. rw%>P%
  1849.  caretcolumn%+cls%-1-ImportCol% maxcolumn%=caretcolumn%+cls%-1-ImportCol%
  1850. Tloadvars
  1851.  filever%
  1852. "i$="":
  1853.  i%=1 
  1854. 17:i$+=
  1855. #c%):
  1856. i$,14)<>"Tau variables " 
  1857. report("That's not a Tau-compatible file!"):=
  1858. filever%=
  1859. i$,3))
  1860.  filever% 
  1861. 100:newC1%=16:newP1%=1024
  1862. 120,130,140,filever%:
  1863. #c%,newC1%,newP1%
  1864. report("This version of Tau is too old for that file!"):=
  1865.  newP1%<minP1% newP1%=minP1%
  1866.  newC1%>maxC1% 
  1867. report("File has too many columns of data!"):=
  1868.  newC1%<2 
  1869. report("File has less than 2 columns of data!"):=
  1870.  newC1%*newP1%>room% newP1%=room% 
  1871.  newC1%
  1872.  changed% 
  1873. filetype%=&83 
  1874. newC1%<>C1% 
  1875. newP1%<>P1% 
  1876. Tjeopardy 
  1877. +C1%=newC1%:P1%=newP1%:C%=C1%-1:P%=P1%-1
  1878. setextent
  1879. #c%,DrawFrame%,DrawXAxis%,DrawYAxis%
  1880. #c%,FrameThick,AxisThick
  1881.  filever%=150 
  1882. #c%,FrameFill%,FrameFillColour%,FrameColour%
  1883. #c%,KeyBack%,KeyOutline%
  1884. #c%,TicksMajorXFrame%,TicksMajorYFrame%,TicksMajorXAxis%,TicksMajorYAxis%
  1885. #c%,TicksMinorXFrame%,TicksMinorYFrame%,TicksMinorXAxis%,TicksMinorYAxis%
  1886. #c%,TicksMajorIn,TicksMajorOut,TicksMajorDown,TicksMajorUp,TicksMajorLeft,TicksMajorRight
  1887. #c%,TicksMinorIn,TicksMinorOut,TicksMinorDown,TicksMinorUp,TicksMinorLeft,TicksMinorRight
  1888. #c%,TicksMajorThick,TicksMinorThick
  1889. #c%,GridsMajorX%,GridsMajorY%,GridsMinorX%,GridsMinorY%
  1890. #c%,GridsDash,GridsGap,GridsThick
  1891. #c%,LabelsXFrame%,LabelsXAxis%,LabelsBelow%,LabelsXMinor%
  1892. #c%,LabelsYFrame%,LabelsYAxis%,LabelsLeft%,LabelsYMinor%,LabelsYRotate%
  1893. #c%,LabelsXOffset,LabelsYOffset
  1894. #c%,FontsLabels$
  1895. #c%,LabelsFontWidth,LabelsFontHeight
  1896. #c%,AxistextXPlot%,AxistextYPlot%,AxistextXFrame%,AxistextYFrame%
  1897. #c%,AxistextBelow%,AxistextLeft%,AxistextRotate%
  1898. #c%,AxistextXOffset,AxistextYOffset,AxistextXSpacing,AxistextYSpacing
  1899. #c%,AxistextXText$,AxistextYText$
  1900. #c%,AxistextFontWidth,AxistextFontHeight
  1901. #c%,GraphWidth,GraphHeight,GraphLeft,GraphBottom,GraphBorder%
  1902. #c%,GraphBorderWidth,GraphBorderHeight,GraphBorderLeft,GraphBorderBottom
  1903. #c%,GraphKey%,GraphKeyLeft,GraphKeyTop
  1904. #c%,ScalingAuto%,ScalingBound%,ScalingXLog%,ScalingYLog%
  1905. #c%,ScalingXMin,ScalingXMax,ScalingXAtYAxis
  1906. #c%,ScalingYMin,ScalingYMax,ScalingYAtXAxis
  1907. #c%,ScalingXDigits%,ScalingYDigits%,ScalingXFormat%,ScalingYFormat%
  1908. #c%,ScalingXMajor,ScalingXMinor,ScalingXAnchor
  1909. #c%,ScalingYMajor,ScalingYMinor,ScalingYAnchor
  1910. #c%,ScalingXLogType%,ScalingYLogType%
  1911.  i%=0 
  1912. #c%,ColumnPlot%(i%)
  1913. #c%,ColumnMeaning$(i%),ColumnKeyText$(i%)
  1914. #c%,ColumnLine%(i%),ColumnThick(i%),ColumnDash(i%),ColumnGap(i%)
  1915. #c%,ColumnFill%(i%),ColumnColour%(i%)
  1916.  convert to 24-bit
  1917.  filever%< 150 
  1918.  ColumnColour%(i%)=
  1919. Treadpalette(ColumnColour%(i%))
  1920. #c%,ColumnPoints%(i%),ColumnChar%(i%),ColumnWidth(i%),ColumnHeight(i%)
  1921. #c%,ColumnError%(i%),ColumnErrorThick(i%),ColumnErrorCap(i%)
  1922.  filever%>= 130 
  1923. #c%,ColumnLinecol%(i%),ColumnCharcol%(i%)
  1924. #c%,ColumnLinestyle%(i%),ColumnDash2(i%)
  1925.  filever%>= 130 
  1926.  filever%< 150 
  1927.  convert colours to 24-bit
  1928. 18ColumnLinecol%(i%)=
  1929. Treadpalette(ColumnLinecol%(i%))
  1930. 28ColumnCharcol%(i%)=
  1931. Treadpalette(ColumnCharcol%(i%))
  1932.  filever%>= 140 
  1933. #c%,ColumnX%(i%)
  1934. #c%,BestFitYColumn%,BestFitForce%,BestFitX,BestFitY
  1935. #c%,FontsPoints$,Calculate$
  1936. #c%,Magnify,JeopardyWarning%
  1937. #c%,SaveIncludePoint%,SaveIncludeMove%,SaveOrder%,SaveLocal%
  1938.  filever%>=140 
  1939. #c%,MultipleX%
  1940.  MultipleX% !iMultipleX%=1 
  1941.  !iMultipleX%=0
  1942. MultipleX%=0
  1943.  SaveType%=-1 SaveType%=1
  1944.  SaveType%<0 
  1945. SaveType%>5 
  1946.  SaveType%=0 
  1947. checkscaling:
  1948.  scalingerror$ 
  1949. report("Can't create a Draw file: bad scaling!"):
  1950. Tcheckfont(FontsPoints$) 
  1951. Tcheckfont(FontsLabels$)) 
  1952. report("Can't create a Draw file: font missing!"):
  1953. I8Save$=Save$(SaveType%):Scrap%=(Save$="<Wimp$Scrap>")
  1954. Save$,".")=0) 
  1955. Scrap% 
  1956. report("Incomplete path name"):
  1957. "Hourglass_On"
  1958. maxcolumnrow
  1959.  SaveType% 
  1960.  DrawFile
  1961. savedrawfile
  1962.  TauFile
  1963. (Save$):fileopen%=c%
  1964. savevars:
  1965. savetaudata:TauFileName$=
  1966. Tleafname(Save$)
  1967. Scrap% 
  1968. changed(
  1969. checkscaling
  1970. #c%:fileopen%=0
  1971.  TauStyle
  1972. (Save$):fileopen%=c%
  1973. savevars:
  1974. checkscaling
  1975. #c%:fileopen%=0
  1976.  CSVFile
  1977. (Save$):fileopen%=c%
  1978. savedatacommas
  1979. #c%:fileopen%=0
  1980.  TextFile
  1981. (Save$):fileopen%=c%
  1982. savedataspaces
  1983. #c%:fileopen%=0
  1984.  BASIC data file, with no. columns (integer) as the first row
  1985. (Save$):fileopen%=c%
  1986. savedatadata
  1987. #c%:fileopen%=0
  1988. 255,"Bad save operation"
  1989. "SetType "+Save$+" "+
  1990. FileType$(SaveType%),3)
  1991.  Scrap% Save$(SaveType%)=OldSave$(SaveType%)
  1992. "Hourglass_Smash"
  1993. savetaudata
  1994. #c%,maxcolumn%,maxrow%
  1995.  rw%=0 
  1996. maxrow%
  1997.  cl%=0 
  1998. maxcolumn%
  1999. Tdata(cl%,rw%)
  2000. #c%,DataStatus%?(cl%+C1%*rw%)
  2001. savedataspaces
  2002. @%=&100060D
  2003. saverange
  2004.  rw%=rw1% 
  2005. #c%:status%=
  2006.  cl%=cl1% 
  2007. |-i$=
  2008. Tdata(workhorse%(cl%),rw%)):l%=
  2009.  l%<12 
  2010. i$,"E"):
  2011.  e%=0 e%=l%+1
  2012. i$,".") j$=
  2013. 12-l%,"0") 
  2014.  j$="."+
  2015. 11-l%,"0")
  2016. ! i$=
  2017. i$,e%-1)+j$+
  2018. i$,l%-e%+1)
  2019. "   "+i$,14)
  2020.  DataStatus%?(workhorse%(cl%)+C1%*rw%) 
  2021. 0:i$="              ":
  2022.  SaveIncludePoint% i$="            . "
  2023. 1:status%=
  2024. 2:i$="              ":
  2025.  SaveIncludeMove% i$="            M "
  2026. 255,"Bad data status value"
  2027.  i%=1 
  2028. i$,i%,1):
  2029. #c%,&0D:
  2030. #c%,&0A
  2031. status% 
  2032. #c%=p%
  2033. savedatacommas
  2034. @%=&100060D
  2035. saverange
  2036.  rw%=rw1% 
  2037. #c%:status%=
  2038.  cl%=cl1% 
  2039. i$=","
  2040.  DataStatus%?(workhorse%(cl%)+C1%*rw%)=1 status%=
  2041. Tdata(workhorse%(cl%),rw%))+","
  2042. (DataStatus%?(workhorse%(cl%)+C1%*rw%)=2) 
  2043. SaveIncludeMove% i$="M,"
  2044. #c%,i$;
  2045. #c%-1
  2046. #c%,&0D:
  2047. #c%,&0A
  2048. status% 
  2049. #c%=p%
  2050. savedatadata
  2051. saverange
  2052.  SaveBinaryColumns% 
  2053. #c%,cl2%-cl1%+1
  2054.  rw%=rw1% 
  2055. #c%:status%=
  2056.  cl%=cl1% 
  2057.  DataStatus%?(workhorse%(cl%)+C1%*rw%)=1 status%=
  2058. Tdata(workhorse%(cl%),rw%)
  2059. status% 
  2060. #c%=p%
  2061. saverange
  2062.  i%,j%
  2063. .rw1%=0:rw2%=maxrow%:cl1%=0:cl2%=maxcolumn%
  2064.  SaveLocal% rw1%=carety1%:rw2%=carety2%:cl1%=caretx1%:cl2%=caretx2%
  2065.  i%=cl1% 
  2066. cl2%:workhorse%(i%)=i%:
  2067.  SaveOrder% 
  2068.  workhorse(cl1%) will equal the column% for the first saved column
  2069.  i%=cl1%
  2070. ColumnMeaning$(i%))<>"X" 
  2071. i%<cl2%
  2072.  i%+=1
  2073. ColumnMeaning$(i%))="X" 
  2074. i%>cl1% 
  2075.   workhorse%(cl1%)=i%
  2076.  j%=cl1%+1 
  2077. i%:workhorse%(j%)=j%-1:
  2078. savevars
  2079. Bi$="Tau variables "+fileversion$:
  2080.  i%=1 
  2081. i$,i%,1):
  2082. #c%,C1%,P1%
  2083. #c%,DrawFrame%,DrawXAxis%,DrawYAxis%
  2084. #c%,FrameThick,AxisThick
  2085.  1.50 next 2 lines
  2086. #c%,FrameFill%,FrameFillColour%,FrameColour%
  2087. #c%,KeyBack%,KeyOutline%
  2088. #c%,TicksMajorXFrame%,TicksMajorYFrame%,TicksMajorXAxis%,TicksMajorYAxis%
  2089. #c%,TicksMinorXFrame%,TicksMinorYFrame%,TicksMinorXAxis%,TicksMinorYAxis%
  2090. #c%,TicksMajorIn,TicksMajorOut,TicksMajorDown,TicksMajorUp,TicksMajorLeft,TicksMajorRight
  2091. #c%,TicksMinorIn,TicksMinorOut,TicksMinorDown,TicksMinorUp,TicksMinorLeft,TicksMinorRight
  2092. #c%,TicksMajorThick,TicksMinorThick
  2093. #c%,GridsMajorX%,GridsMajorY%,GridsMinorX%,GridsMinorY%
  2094. #c%,GridsDash,GridsGap,GridsThick
  2095. #c%,LabelsXFrame%,LabelsXAxis%,LabelsBelow%,LabelsXMinor%
  2096. #c%,LabelsYFrame%,LabelsYAxis%,LabelsLeft%,LabelsYMinor%,LabelsYRotate%
  2097. #c%,LabelsXOffset,LabelsYOffset
  2098. #c%,FontsLabels$
  2099. #c%,LabelsFontWidth,LabelsFontHeight
  2100. #c%,AxistextXPlot%,AxistextYPlot%,AxistextXFrame%,AxistextYFrame%
  2101. #c%,AxistextBelow%,AxistextLeft%,AxistextRotate%
  2102. #c%,AxistextXOffset,AxistextYOffset,AxistextXSpacing,AxistextYSpacing
  2103. #c%,AxistextXText$,AxistextYText$
  2104. #c%,AxistextFontWidth,AxistextFontHeight
  2105. #c%,GraphWidth,GraphHeight,GraphLeft,GraphBottom,GraphBorder%
  2106. #c%,GraphBorderWidth,GraphBorderHeight,GraphBorderLeft,GraphBorderBottom
  2107. #c%,GraphKey%,GraphKeyLeft,GraphKeyTop
  2108. #c%,ScalingAuto%,ScalingBound%,ScalingXLog%,ScalingYLog%
  2109. #c%,ScalingXMin,ScalingXMax,ScalingXAtYAxis
  2110. #c%,ScalingYMin,ScalingYMax,ScalingYAtXAxis
  2111. #c%,ScalingXDigits%,ScalingYDigits%,ScalingXFormat%,ScalingYFormat%
  2112. #c%,ScalingXMajor,ScalingXMinor,ScalingXAnchor
  2113. #c%,ScalingYMajor,ScalingYMinor,ScalingYAnchor
  2114. #c%,ScalingXLogType%,ScalingYLogType%
  2115.  i%=0 
  2116. #c%,ColumnPlot%(i%)
  2117. #c%,ColumnMeaning$(i%),ColumnKeyText$(i%)
  2118. #c%,ColumnLine%(i%),ColumnThick(i%),ColumnDash(i%),ColumnGap(i%)
  2119. #c%,ColumnFill%(i%),ColumnColour%(i%)
  2120. #c%,ColumnPoints%(i%),ColumnChar%(i%),ColumnWidth(i%),ColumnHeight(i%)
  2121. #c%,ColumnError%(i%),ColumnErrorThick(i%),ColumnErrorCap(i%)
  2122. #c%,ColumnLinecol%(i%),ColumnCharcol%(i%)
  2123. #c%,ColumnLinestyle%(i%),ColumnDash2(i%)
  2124. #c%,ColumnX%(i%)
  2125. #c%,BestFitYColumn%,BestFitForce%,BestFitX,BestFitY
  2126. #c%,FontsPoints$,Calculate$
  2127. #c%,Magnify,JeopardyWarning%
  2128. #c%,SaveIncludePoint%,SaveIncludeMove%,SaveOrder%,SaveLocal%
  2129. #c%,MultipleX%
  2130. Tleafname(file$)
  2131. file$,".")
  2132.  file$=
  2133. file$,i%+1)
  2134. file$,".")
  2135. =file$
  2136. savedrawfile
  2137.  length%
  2138. length%=
  2139. Tgenerate(
  2140.  length% 
  2141. "Save "+Save$+" "+
  2142. ~Himem%+" +"+
  2143. ~length%
  2144.  ViewOn% 
  2145. view(length%) 
  2146. "Wimp_SlotSize",MinSlotSize%,-1
  2147. "Wimp_SlotSize",MinSlotSize%,-1
  2148. (Save$):fileopen%=c%
  2149.  length%=
  2150. Tgenerate(
  2151. #c%:fileopen%=0
  2152.  ##### transfer between window icons and program variables #####
  2153. cancelOK
  2154.  icon%=1 
  2155. putvariables(window%)
  2156.  window%=scalinghandle% 
  2157. checkscaling
  2158.  button%=4 
  2159. "Wimp_CreateMenu",,-1
  2160. getvariables(window%)
  2161. "Wimp_CreateMenu",,mainmenu%
  2162.  window%=savehandle% 
  2163. icon%=1 
  2164.  window%=edithandle% 
  2165. icon%=1 
  2166. pkiedit
  2167. getvariables(handle%)
  2168. @%=&1000405
  2169.  ScalingAuto% 
  2170. autoscale
  2171.  handle% 
  2172.  framehandle%:
  2173. getframe
  2174.  tickshandle%:
  2175. getticks
  2176.  gridshandle%:
  2177. getgrids
  2178.  labelshandle%:
  2179. getlabels
  2180.  axistexthandle%:
  2181. getaxistext
  2182.  sizehandle%:
  2183. getsize
  2184.  scalinghandle%:
  2185. getscaling
  2186.  columnhandle%:
  2187. getcolumn
  2188.  savehandle%:
  2189. getsave
  2190.  calculatehandle%:
  2191. getcalculate
  2192.  optionshandle%:
  2193. getoptions
  2194.  bestfithandle%:
  2195. getbestfit
  2196.  fontshandle%:
  2197. getfonts
  2198.  magnifyhandle%:
  2199. getmagnify
  2200.  meaninghandle%:
  2201. getmeaning
  2202.  weedhandle%:
  2203. getweed
  2204.  importhandle%:
  2205. getimport
  2206.  downtohandle%:
  2207. getdownto
  2208.  manyhandle%:
  2209. getmany
  2210.  worksheethandle%:@%=&1000005:
  2211. getworksheet
  2212. selectvariables(handle%,icon%)
  2213.  handle% 
  2214.  framehandle%:
  2215. selectframe
  2216.  tickshandle%:
  2217. selectticks
  2218.  gridshandle%:
  2219. selectgrids
  2220.  labelshandle%:
  2221. selectlabels
  2222.  axistexthandle%:
  2223. selectaxistext
  2224.  sizehandle%:
  2225. selectsize
  2226.  scalinghandle%:
  2227. selectscaling
  2228.  columnhandle%:
  2229. selectcolumn
  2230.  optionshandle%:
  2231. selectoptions
  2232.  bestfithandle%:
  2233. selectbestfit
  2234.  meaninghandle%:
  2235. selectmeaning
  2236.  weedhandle%:
  2237. selectweed
  2238.  importhandle%:
  2239. selectimport
  2240.  downtohandle%:
  2241. selectdownto
  2242. putvariables(handle%)
  2243.  chng%
  2244. chng%=
  2245.  handle% 
  2246.  framehandle%:
  2247. putframe
  2248.  tickshandle%:
  2249. putticks
  2250.  gridshandle%:
  2251. putgrids
  2252.  labelshandle%:
  2253. putlabels
  2254.  axistexthandle%:
  2255. putaxistext
  2256.  sizehandle%:
  2257. putsize
  2258.  scalinghandle%:
  2259. putscaling
  2260.  columnhandle%:
  2261. putcolumn
  2262.  savehandle%:
  2263. putsave:chng%=
  2264.  calculatehandle%:
  2265. putcalculate
  2266.  optionshandle%:
  2267. putoptions:chng%=
  2268.  bestfithandle%:
  2269. putbestfit
  2270.  fontshandle%:
  2271. putfonts
  2272.  magnifyhandle%:
  2273. putmagnify
  2274.  meaninghandle%:
  2275. putmeaning
  2276.  weedhandle%:
  2277. putweed
  2278.  importhandle%:
  2279. putimport:chng%=
  2280.  downtohandle%:
  2281. putdownto:chng%=
  2282.  manyhandle%:
  2283. putmany
  2284.  worksheethandle%:
  2285. putworksheet:chng%=
  2286.  chng% 
  2287. changed(
  2288. setwritable(ih%,v)
  2289. setwritablestring(ih%,
  2290. setwritablestring(ih%,v$)
  2291. jA!block1%=handle%:block1%!4=ih%:
  2292. "Wimp_GetIconState",,block1%
  2293. k indir%=block1%!28:$indir%=v$
  2294. Tgetwritable(ih%)
  2295. Tgetwritablestring(ih%))
  2296. Tgetwritablestring(ih%)
  2297. rA!block1%=handle%:block1%!4=ih%:
  2298. "Wimp_GetIconState",,block1%
  2299. indir%=block1%!28
  2300. =$indir%
  2301. setselectgrey(i1%,i2%)
  2302.  s%() indicates selected icons, g%() indicates UN-greyed icons
  2303. y+!block1%=handle%:block1%!12=sel% 
  2304. grey%
  2305.  i%=i1% 
  2306. {;block1%!4=i%:block1%!8=(s%(i%) 
  2307. sel%) 
  2308. g%(i%) 
  2309. grey%)
  2310. "Wimp_SetIconState",,block1%
  2311. getframe
  2312. setwritable(7,FrameThick):
  2313. setwritable(8,AxisThick)
  2314. =s%()=
  2315. :s%(4)=DrawFrame%:s%(5)=DrawXAxis%:s%(6)=DrawYAxis%
  2316. s%(11)=FrameFill%
  2317. s%(13)=FrameFillColour%
  2318. s%(14)=FrameColour%
  2319. setcolour(framehandle%,14,s%(14),"line")
  2320. greyframe
  2321. greyframe
  2322. )g%()=
  2323. :g%(7)=s%(4):g%(8)=s%(5) 
  2324. s%(6)
  2325. setselectgrey(4,11)
  2326.  s%(11) 
  2327. setcolour(framehandle%,13,s%(13),"fill")
  2328. setgreycolour(framehandle%,13,"fill")
  2329. selectframe
  2330. s%(icon%)=
  2331. s%(icon%)
  2332. greyframe
  2333. putframe
  2334. :FrameThick=
  2335. Tgetwritable(7):AxisThick=
  2336. Tgetwritable(8)
  2337. 6DrawFrame%=s%(4):DrawXAxis%=s%(5):DrawYAxis%=s%(6)
  2338. -FrameFill%=s%(11):FrameFillColour%=s%(13)
  2339. FrameColour%=s%(14)
  2340. getticks
  2341. setwritable(4,TicksMajorThick):
  2342. setwritable(9,TicksMajorDown):
  2343. setwritable(10,TicksMajorUp)
  2344. setwritable(11,TicksMajorLeft):
  2345. setwritable(12,TicksMajorRight):
  2346. setwritable(13,TicksMajorIn)
  2347. setwritable(14,TicksMajorOut):
  2348. setwritable(15,TicksMinorThick):
  2349. setwritable(20,TicksMinorDown)
  2350. setwritable(21,TicksMinorUp):
  2351. setwritable(22,TicksMinorLeft):
  2352. setwritable(23,TicksMinorRight)
  2353. setwritable(24,TicksMinorIn):
  2354. setwritable(25,TicksMinorOut)
  2355. hs%()=
  2356. :s%(5)=TicksMajorXAxis%:s%(6)=TicksMajorYAxis%:s%(7)=TicksMajorXFrame%:s%(8)=TicksMajorYFrame%
  2357. es%(16)=TicksMinorXAxis%:s%(17)=TicksMinorYAxis%:s%(18)=TicksMinorXFrame%:s%(19)=TicksMinorYFrame%
  2358. greyticks
  2359. greyticks
  2360. g%()=
  2361. dg%(5)=DrawXAxis%:g%(9)=g%(5) 
  2362. s%(5):g%(10)=g%(9):g%(16)=g%(9):g%(20)=g%(9) 
  2363. s%(16):g%(21)=g%(20)
  2364. hg%(6)=DrawYAxis%:g%(11)=g%(6) 
  2365. s%(6):g%(12)=g%(11):g%(17)=g%(11):g%(22)=g%(11) 
  2366. s%(17):g%(23)=g%(22)
  2367. Kg%(7)=DrawFrame%:g%(8)=g%(7):g%(13)=g%(7) 
  2368. (s%(7) 
  2369. s%(8)):g%(14)=g%(13)
  2370. cg%(18)=g%(7) 
  2371. s%(7):g%(19)=g%(8) 
  2372. s%(8):g%(24)=(g%(18) 
  2373. s%(18)) 
  2374. (g%(19) 
  2375. s%(19)):g%(25)=g%(24)
  2376. =g%(4)=g%(9) 
  2377. g%(11) 
  2378. g%(13):g%(15)=g%(20) 
  2379. g%(22) 
  2380. g%(24)
  2381. setselectgrey(4,25)
  2382. selectticks
  2383. s%(icon%)=
  2384. s%(icon%)
  2385. greyticks
  2386. putticks
  2387. cTicksMajorThick=
  2388. Tgetwritable(4):TicksMajorDown=
  2389. Tgetwritable(9):TicksMajorUp=
  2390. Tgetwritable(10)
  2391. eTicksMajorLeft=
  2392. Tgetwritable(11):TicksMajorRight=
  2393. Tgetwritable(12):TicksMajorIn=
  2394. Tgetwritable(13)
  2395. fTicksMajorOut=
  2396. Tgetwritable(14):TicksMinorThick=
  2397. Tgetwritable(15):TicksMinorDown=
  2398. Tgetwritable(20)
  2399. eTicksMinorUp=
  2400. Tgetwritable(21):TicksMinorLeft=
  2401. Tgetwritable(22):TicksMinorRight=
  2402. Tgetwritable(23)
  2403. BTicksMinorIn=
  2404. Tgetwritable(24):TicksMinorOut=
  2405. Tgetwritable(25)
  2406. aTicksMajorXFrame%=s%(7):TicksMajorYFrame%=s%(8):TicksMajorXAxis%=s%(5):TicksMajorYAxis%=s%(6)
  2407. eTicksMinorXFrame%=s%(18):TicksMinorYFrame%=s%(19):TicksMinorXAxis%=s%(16):TicksMinorYAxis%=s%(17)
  2408. getgrids
  2409. setwritable(7,GridsDash):
  2410. setwritable(8,GridsGap):
  2411. setwritable(9,GridsThick)
  2412. Vs%()=
  2413. :s%(3)=GridsMajorX%:s%(4)=GridsMajorY%:s%(5)=GridsMinorX%:s%(6)=GridsMinorY%
  2414. greygrids
  2415. greygrids
  2416. Mg%()=
  2417. :g%(5)=s%(3):g%(6)=s%(4):g%(7)=s%(3) 
  2418. s%(4):g%(8)=g%(7):g%(9)=g%(7)
  2419. setselectgrey(3,9)
  2420. selectgrids
  2421. s%(icon%)=
  2422. s%(icon%)
  2423. greygrids
  2424. putgrids
  2425. TGridsDash=
  2426. Tgetwritable(7):GridsGap=
  2427. Tgetwritable(8):GridsThick=
  2428. Tgetwritable(9)
  2429. OGridsMajorX%=s%(3):GridsMajorY%=s%(4):GridsMinorX%=s%(5):GridsMinorY%=s%(6)
  2430. getlabels
  2431. setwritable(14,LabelsXOffset):
  2432. setwritable(15,LabelsYOffset)
  2433. setwritable(16,LabelsFontWidth):
  2434. setwritable(17,LabelsFontHeight)
  2435. Xs%()=
  2436. :s%(5)=LabelsXFrame%:s%(6)=LabelsXAxis%:s%(7)=LabelsBelow%:s%(8)=LabelsXMinor%
  2437. is%(9)=LabelsYFrame%:s%(10)=LabelsYAxis%:s%(11)=LabelsLeft%:s%(12)=LabelsYMinor%:s%(13)=LabelsYRotate%
  2438. greylabels
  2439. greylabels
  2440. ]g%()=
  2441. :g%(5)=DrawFrame%:g%(6)=DrawXAxis%:g%(7)=(g%(5) 
  2442. s%(5)) 
  2443. (g%(6) 
  2444. s%(6)):g%(8)=g%(7)
  2445. jg%(9)=DrawFrame%:g%(10)=DrawYAxis%:g%(11)=(g%(9) 
  2446. s%(9)) 
  2447. (g%(10) 
  2448. s%(10)):g%(12)=g%(11):g%(13)=g%(11)
  2449. Ag%(14)=g%(7):g%(15)=g%(11):g%(16)=g%(7) 
  2450. g%(11):g%(17)=g%(16)
  2451. setselectgrey(5,17)
  2452. selectlabels
  2453. s%(icon%)=
  2454. s%(icon%)
  2455.  icon% 
  2456. 5,6,9,10:
  2457. greylabels
  2458. putlabels
  2459. CLabelsXOffset=
  2460. Tgetwritable(14):LabelsYOffset=
  2461. Tgetwritable(15)
  2462. HLabelsFontWidth=
  2463. Tgetwritable(16):LabelsFontHeight=
  2464. Tgetwritable(17)
  2465. QLabelsXFrame%=s%(5):LabelsXAxis%=s%(6):LabelsBelow%=s%(7):LabelsXMinor%=s%(8)
  2466. iLabelsYFrame%=s%(9):LabelsYAxis%=s%(10):LabelsLeft%=s%(11):LabelsYMinor%=s%(12):LabelsYRotate%=s%(13)
  2467. getaxistext
  2468. setwritable(8,AxistextXOffset):
  2469. setwritable(9,AxistextXSpacing)
  2470. setwritable(15,AxistextYOffset):
  2471. setwritable(16,AxistextYSpacing)
  2472. setwritablestring(10,AxistextXText$):
  2473. setwritablestring(17,AxistextYText$)
  2474. setwritable(18,AxistextFontWidth):
  2475. setwritable(19,AxistextFontHeight)
  2476. Js%()=
  2477. :s%(5)=AxistextXPlot%:s%(6)=AxistextXFrame%:s%(7)=AxistextBelow%
  2478. \s%(11)=AxistextYPlot%:s%(12)=AxistextYFrame%:s%(13)=AxistextLeft%:s%(14)=AxistextRotate%
  2479. greyaxistext
  2480. greyaxistext
  2481. :g%()=
  2482. :g%(5)=DrawFrame% 
  2483. DrawXAxis%:g%(6)=g%(5) 
  2484. s%(5)
  2485. <g%(7)=((DrawFrame% 
  2486. s%(6)) 
  2487. (DrawXAxis% 
  2488. s%(6))) 
  2489. s%(5)
  2490. 7g%(11)=DrawFrame% 
  2491. DrawYAxis%:g%(12)=g%(11) 
  2492. s%(11)
  2493. Ng%(13)=((DrawFrame% 
  2494. s%(12)) 
  2495. (DrawYAxis% 
  2496. s%(12))) 
  2497. s%(11):g%(14)=g%(13)
  2498. Rg%(8)=g%(7):g%(9)=g%(7):g%(10)=g%(7):g%(15)=g%(13):g%(16)=g%(13):g%(17)=g%(13)
  2499. &g%(18)=g%(7) 
  2500. g%(13):g%(19)=g%(18)
  2501. setselectgrey(5,19)
  2502. selectaxistext
  2503. s%(icon%)=
  2504. s%(icon%)
  2505.  icon% 
  2506. 5,6,11,12:
  2507. greyaxistext
  2508. putaxistext
  2509. FAxistextXOffset=
  2510. Tgetwritable(8):AxistextYOffset=
  2511. Tgetwritable(15)
  2512. HAxistextXSpacing=
  2513. Tgetwritable(9):AxistextYSpacing=
  2514. Tgetwritable(16)
  2515. QAxistextXText$=
  2516. Tgetwritablestring(10):AxistextYText$=
  2517. Tgetwritablestring(17)
  2518. LAxistextFontWidth=
  2519. Tgetwritable(18):AxistextFontHeight=
  2520. Tgetwritable(19)
  2521. CAxistextXPlot%=s%(5):AxistextXFrame%=s%(6):AxistextBelow%=s%(7)
  2522. \AxistextYPlot%=s%(11):AxistextYFrame%=s%(12):AxistextLeft%=s%(13):AxistextRotate%=s%(14)
  2523. getsize
  2524. setwritable(5,GraphWidth):
  2525. setwritable(6,GraphHeight)
  2526. setwritable(7,GraphLeft):
  2527. setwritable(8,GraphBottom)
  2528. setwritable(10,GraphBorderWidth):
  2529. setwritable(11,GraphBorderHeight)
  2530. setwritable(12,GraphBorderLeft):
  2531. setwritable(13,GraphBorderBottom)
  2532. setwritable(15,GraphKeyLeft):
  2533. setwritable(16,GraphKeyTop)
  2534.  .s%()=
  2535. :s%(9)=GraphBorder%:s%(14)=GraphKey%
  2536. s%(30)=KeyBack%
  2537. s%(32)=KeyOutline%
  2538. greysize
  2539. greysize
  2540. g%()=
  2541. (:g%(10)=s%(9):g%(11)=g%(10):g%(12)=g%(10):g%(13)=g%(10)
  2542. g%(15)=s%(14):g%(16)=g%(15)
  2543. setselectgrey(5,16)
  2544. s%(14) 
  2545. setgreycolour(handle%,30,"fill"):
  2546. setgreycolour(handle%,32,"line")
  2547. setcolour(handle%,30,s%(30),"fill"):
  2548. setcolour(handle%,32,s%(32),"line")
  2549. selectsize
  2550. s%(icon%)=
  2551. s%(icon%)
  2552. greysize
  2553. putsize
  2554. 8<GraphWidth=
  2555. Tgetwritable(5):GraphHeight=
  2556. Tgetwritable(6)
  2557. 9;GraphLeft=
  2558. Tgetwritable(7):GraphBottom=
  2559. Tgetwritable(8)
  2560. :JGraphBorderWidth=
  2561. Tgetwritable(10):GraphBorderHeight=
  2562. Tgetwritable(11)
  2563. ;IGraphBorderLeft=
  2564. Tgetwritable(12):GraphBorderBottom=
  2565. Tgetwritable(13)
  2566. <@GraphKeyLeft=
  2567. Tgetwritable(15):GraphKeyTop=
  2568. Tgetwritable(16)
  2569. =&KeyBack%=s%(30):KeyOutline%=s%(32)
  2570. >'GraphBorder%=s%(9):GraphKey%=s%(14)
  2571. getscaling
  2572. setwritable(10,ScalingXMin):
  2573. setwritable(11,ScalingXMax):
  2574. setwritable(12,ScalingXAtYAxis)
  2575. setwritable(13,ScalingXDigits%):
  2576. setwritable(14,ScalingYMin):
  2577. setwritable(15,ScalingYMax)
  2578. setwritable(16,ScalingYAtXAxis):
  2579. setwritable(17,ScalingYDigits%)
  2580. setwritable(18,ScalingXMajor):
  2581. setwritable(19,ScalingXMinor):
  2582. setwritable(20,ScalingXAnchor)
  2583. setwritable(21,ScalingYMajor):
  2584. setwritable(22,ScalingYMinor):
  2585. setwritable(23,ScalingYAnchor)
  2586. GXs%()=
  2587. :s%(7)=ScalingAuto%:s%(34)=ScalingBound%:s%(8)=ScalingXLog%:s%(9)=ScalingYLog%
  2588. H7s%(27-ScalingXLogType%)=
  2589. :s%(32-ScalingYLogType%)=
  2590. I5s%(37+ScalingXFormat%)=
  2591. :s%(42+ScalingYFormat%)=
  2592. J1tempx%=ScalingXDigits%:tempy%=ScalingYDigits%
  2593. KD!block%=scalinghandle%:block%!4=13:
  2594. "Wimp_GetIconState",,block%
  2595. L>ix1%=block%!8:iy1%=block%!12:ix2%=block%!16:iy2%=block%!20
  2596. MD!block%=scalinghandle%:block%!4=17:
  2597. "Wimp_GetIconState",,block%
  2598. N>jx1%=block%!8:jy1%=block%!12:jx2%=block%!16:jy2%=block%!20
  2599. greyscaling
  2600. greyscaling
  2601.  ScalingAuto% 
  2602. T! g%()=
  2603. :g%(7)=
  2604.  g%(34)=TRUE
  2605.  g%(8)=
  2606. :g%(9)=
  2607. WP g%()=
  2608. :g%(24)=s%(8):g%(25)=g%(24):g%(26)=g%(24):g%(27)=g%(24):g%(28)=g%(24)
  2609. X7 g%(18)=s%(28) 
  2610. g%(24):g%(19)=g%(18):g%(20)=g%(18)
  2611. YI g%(29)=s%(9):g%(30)=g%(29):g%(31)=g%(29):g%(32)=g%(29):g%(33)=g%(29)
  2612. Z7 g%(21)=s%(33) 
  2613. g%(29):g%(22)=g%(21):g%(23)=g%(21)
  2614. setselectgrey(7,44)
  2615. selectscaling
  2616.  icon% 
  2617.  autoscale clicked, must change AutoScale% and scale immediately
  2618. c$ s%(7)=
  2619. s%(7):ScalingAuto%=s%(7)
  2620. 24,25,26,27,28:
  2621.  X log radio icons
  2622.  i%=24 
  2623. 28:s%(i%)=(i%=icon%):
  2624. 29,30,31,32,33:
  2625.  Y log radio icons
  2626.  i%=29 
  2627. 33:s%(i%)=(i%=icon%):
  2628. 35,36:
  2629.  X arrow icons
  2630. i" tempx%+=(icon%=36)-(icon%=35)
  2631.  tempx%<1 tempx%=10 
  2632.  tempx%>10 tempx%=1
  2633. setwritable(13,tempx%):
  2634. "Wimp_ForceRedraw",scalinghandle%,ix1%,iy1%,ix2%,iy2%
  2635. 40,41:
  2636.  Y arrow icons
  2637. m" tempy%+=(icon%=41)-(icon%=40)
  2638.  tempy%<1 tempy%=10 
  2639.  tempy%>10 tempy%=1
  2640. setwritable(17,tempy%):
  2641. "Wimp_ForceRedraw",scalinghandle%,jx1%,jy1%,jx2%,jy2%
  2642. 37,38,39:
  2643.  X format radio icons
  2644.  i%=37 
  2645. 39:s%(i%)=(i%=icon%):
  2646. 42,43,44:
  2647.  X format radio icons
  2648.  i%=42 
  2649. 44:s%(i%)=(i%=icon%):
  2650.  normal icons
  2651.  s%(icon%)=
  2652. s%(icon%)
  2653.  ScalingAuto% 
  2654. x? ScalingBound%=s%(34):ScalingXLog%=s%(8):ScalingYLog%=s%(9)
  2655. autoscale
  2656. zS icon%=2:button%=1:
  2657. cancelOK:
  2658.  imitates click on Cancel icon with Adjust button
  2659.  icon%<34 
  2660. greyscaling
  2661. putscaling
  2662. aScalingXMin=
  2663. Tgetwritable(10):ScalingXMax=
  2664. Tgetwritable(11):ScalingXAtYAxis=
  2665. Tgetwritable(12)
  2666. %ScalingXDigits%=
  2667. Tgetwritable(13)
  2668. aScalingYMin=
  2669. Tgetwritable(14):ScalingYMax=
  2670. Tgetwritable(15):ScalingYAtXAxis=
  2671. Tgetwritable(16)
  2672. %ScalingYDigits%=
  2673. Tgetwritable(17)
  2674. dScalingXMajor=
  2675. Tgetwritable(18):ScalingXMinor=
  2676. Tgetwritable(19):ScalingXAnchor=
  2677. Tgetwritable(20)
  2678. dScalingYMajor=
  2679. Tgetwritable(21):ScalingYMinor=
  2680. Tgetwritable(22):ScalingYAnchor=
  2681. Tgetwritable(23)
  2682. 0i%=4:
  2683. :i%-=1:
  2684.  s%(27-i%):ScalingXLogType%=i%
  2685. 0i%=4:
  2686. :i%-=1:
  2687.  s%(32-i%):ScalingYLogType%=i%
  2688. /i%=3:
  2689. :i%-=1:
  2690.  s%(37+i%):ScalingXFormat%=i%
  2691. /i%=3:
  2692. :i%-=1:
  2693.  s%(42+i%):ScalingYFormat%=i%
  2694. >ScalingBound%=s%(34):ScalingXLog%=s%(8):ScalingYLog%=s%(9)
  2695. checkscaling
  2696. scalingerror$=""
  2697.  ScalingXLog% 
  2698.  ScalingXMin<=0 
  2699. adderror("min x value bad for log scale")
  2700.  ScalingXMajor<ScalingXMinor 
  2701. adderror("minor>major in x spacing")
  2702.  ScalingXMajor<=0 
  2703. ScalingXMinor<=0 
  2704. adderror("x spacing <= 0")
  2705.  ScalingYLog% 
  2706.  ScalingYMin<=0 
  2707. adderror("min y value bad for log scale")
  2708.  ScalingYMajor<ScalingYMinor 
  2709. adderror("minor>major in y spacing")
  2710.  ScalingYMajor<=0 
  2711. ScalingYMinor<=0 
  2712. adderror("y spacing <= 0")
  2713.  ScalingXMin>=ScalingXMax 
  2714. adderror("min>=max in x values")
  2715.  ScalingYMin>=ScalingYMax 
  2716. adderror("min>=max in y values")
  2717.  ScalingXDigits%<1 
  2718. ScalingXDigits%>10 
  2719. adderror("bad number of x digits")
  2720.  ScalingYDigits%<1 
  2721. ScalingYDigits%>10 
  2722. adderror("bad number of y digits")
  2723.  scalingerror$ 
  2724. report(scalingerror$):button%=1
  2725. adderror(i$)
  2726.  scalingerror$ scalingerror$+=", "+i$ 
  2727.  scalingerror$=i$
  2728. getcolumn
  2729. handle%=columnhandle%
  2730. setwritable(3,caretcolumn%):
  2731. setwritablestring(4,ColumnMeaning$(caretcolumn%))
  2732. setwritable(7,ColumnThick(caretcolumn%))
  2733. setwritable(8,ColumnDash(caretcolumn%)):
  2734. setwritable(9,ColumnGap(caretcolumn%))
  2735. setwritable(11,ColumnErrorThick(caretcolumn%)):
  2736. setwritable(12,ColumnErrorCap(caretcolumn%))
  2737. setwritable(17,ColumnWidth(caretcolumn%)):
  2738. setwritable(18,ColumnHeight(caretcolumn%))
  2739. setwritable(19,ColumnChar%(caretcolumn%)):
  2740. setwritablestring(13,ColumnKeyText$(caretcolumn%))
  2741. setwritable(45,ColumnDash2(caretcolumn%))
  2742. setwritablestring(47,style$(ColumnLinestyle%(caretcolumn%)))
  2743.  MultipleX% 
  2744. ColumnMeaning$(caretcolumn%),1)<>"X" 
  2745. setwritable(49,ColumnX%(caretcolumn%)) 
  2746. setwritable(49,0)
  2747. 'tempchar%=ColumnChar%(caretcolumn%)
  2748. =!block%=handle%:block%!4=19:
  2749. "Wimp_GetIconState",,block%
  2750. >ix1%=block%!8:iy1%=block%!12:ix2%=block%!16:iy2%=block%!20
  2751. =!block%=handle%:block%!4=22:
  2752. "Wimp_GetIconState",,block%
  2753. >jx1%=block%!8:jy1%=block%!12:jx2%=block%!16:jy2%=block%!20
  2754. Js%()=
  2755. :s%(5)=ColumnPlot%(caretcolumn%):s%(6)=ColumnLine%(caretcolumn%)
  2756. is%(10)=ColumnError%(caretcolumn%):s%(16)=ColumnPoints%(caretcolumn%):s%(14)=ColumnFill%(caretcolumn%)
  2757. &s%(15)=ColumnColour%(caretcolumn%)
  2758. 's%(41)=ColumnLinecol%(caretcolumn%)
  2759. 's%(43)=ColumnCharcol%(caretcolumn%)
  2760. greycolumn
  2761. greycolumn
  2762.  i%,i$
  2763. ColumnMeaning$(caretcolumn%),1)<>"Y" 
  2764.  g%()=
  2765. :g%(5)=
  2766. :g%(4)=
  2767. setgrey(47,
  2768. setgrey(8,
  2769. setgrey(9,
  2770. setgrey(45,
  2771. setgreycolour(columnhandle%,41,"line")
  2772. setgreycolour(columnhandle%,43,"char")
  2773. / g%()=
  2774. :g%(7)=s%(6):g%(8)=g%(7):g%(9)=g%(7)
  2775.   g%(11)=s%(10):g%(12)=g%(11)
  2776. X g%(17)=s%(16):g%(18)=g%(17):g%(19)=g%(17):g%(20)=g%(17):g%(21)=g%(17):g%(22)=g%(17)
  2777. ) g%(14)=
  2778. ScalingYLog% 
  2779. ScalingBound%
  2780. # g%(13)=GraphKey%:g%(15)=s%(14)
  2781.  s%(6) 
  2782. $  i$=
  2783. Tgetwritablestring(47),3)
  2784.   i%=-1
  2785.   i%+=1
  2786. style$(i%),3)=i$
  2787. setgrey(47,
  2788. setthestyle(i%)
  2789. setgrey(47,
  2790. setgrey(8,
  2791. setgrey(9,
  2792. setgrey(45,
  2793. setselectgrey(4,22)
  2794. g%(15) 
  2795. grey%) 
  2796. setgreycolour(handle%,15,"fill")
  2797. setcolour(handle%,15,s%(15),"fill")
  2798. s%(16) 
  2799. setgreycolour(handle%,43,"char")
  2800. setcolour(handle%,43,s%(43),"char")
  2801. s%(6) 
  2802. setgreycolour(handle%,41,"line")
  2803. setcolour(handle%,41,s%(41),"line")
  2804. setgrey(49,MultipleX% 
  2805. ColumnMeaning$(caretcolumn%),1)<>"X")
  2806. "Wimp_ForceRedraw",handle%,jx1%,jy1%,jx2%,jy2%
  2807. selectcolumn
  2808. tempchar%=
  2809. Tgetwritable(19)
  2810.  icon% 
  2811. 20,21:
  2812.  arrow icons
  2813. :tempchar%+=(icon%=21)-(icon%=20):
  2814.  tempchar%<>127
  2815.  tempchar%<32 tempchar%=255 
  2816.  tempchar%>255 tempchar%=32
  2817. setwritable(19,tempchar%):
  2818. "Wimp_ForceRedraw",handle%,ix1%,iy1%,ix2%,iy2%
  2819. "Wimp_ForceRedraw",handle%,jx1%,jy1%,jx2%,jy2%
  2820.  normal icons
  2821.  s%(icon%)=
  2822. s%(icon%)
  2823. greycolumn
  2824. redrawcolumn
  2825.  x%,y%,i$,dofont%,fonthandle%,bx1%,by1%,bx2%,by2%,cl%
  2826. !block%=columnhandle%:SYS"Wimp_GetWindowState",,block%
  2827. Tx%=block%!4-block%!20:y%=block%!16-block%!24:
  2828.  screen co-ords of top-left corner
  2829.  tempchar%:dofont%=
  2830.  dofont%=
  2831.  dofont% 
  2832. "Font_FindFont",,FontsPoints$,16*32,16*32 
  2833. fonthandle%
  2834. "Font_CharBBox",fonthandle%,tempchar%,16 
  2835. ,bx1%,by1%,bx2%,by2%
  2836.  g%(19) cl%=7 
  2837.  cl%=2
  2838. "Wimp_SetFontColours",,0,cl%
  2839. "Font_Paint",,i$,16,x%+(jx1%+jx2%)/2-(bx1%+bx2%)/2,y%+(jy1%+jy2%)/2-(by1%+by2%)/2
  2840. "Font_LoseFont",fonthandle%
  2841. "Wimp_SetColour",11
  2842. x%+jx1%+56,y%+jy2%-32:
  2843. "Bad"
  2844. x%+jx1%+48,y%+jy2%-72:
  2845. "Font"
  2846. putcolumn
  2847.  i%,i$
  2848. handle%=columnhandle%
  2849. .ColumnThick(caretcolumn%)=
  2850. Tgetwritable(7)
  2851. VColumnDash(caretcolumn%)=
  2852. Tgetwritable(8):ColumnGap(caretcolumn%)=
  2853. Tgetwritable(9)
  2854. cColumnErrorThick(caretcolumn%)=
  2855. Tgetwritable(11):ColumnErrorCap(caretcolumn%)=
  2856. Tgetwritable(12)
  2857. \ColumnWidth(caretcolumn%)=
  2858. Tgetwritable(17):ColumnHeight(caretcolumn%)=
  2859. Tgetwritable(18)
  2860. dColumnChar%(caretcolumn%)=
  2861. Tgetwritable(19):ColumnKeyText$(caretcolumn%)=
  2862. Tgetwritablestring(13)
  2863.  MultipleX% 
  2864. ColumnMeaning$(caretcolumn%),1)<>"X" ColumnX%(caretcolumn%)=
  2865. Tgetwritable(49)
  2866.      "i$=
  2867. Tgetwritablestring(47),3)
  2868.     !    i%=-1
  2869.     #    i%+=1
  2870. style$(i%),3)=i$
  2871.     %%ColumnLinestyle%(caretcolumn%)=i%
  2872.     &/ColumnDash2(caretcolumn%)=
  2873. Tgetwritable(45)
  2874.     'CColumnPlot%(caretcolumn%)=s%(5):ColumnLine%(caretcolumn%)=s%(6)
  2875.     (iColumnError%(caretcolumn%)=s%(10):ColumnPoints%(caretcolumn%)=s%(16):ColumnFill%(caretcolumn%)=s%(14)
  2876.     )&ColumnColour%(caretcolumn%)=s%(15)
  2877.     *'ColumnLinecol%(caretcolumn%)=s%(41)
  2878.     +'ColumnCharcol%(caretcolumn%)=s%(43)
  2879.  ScalingAuto% 
  2880. autoscale
  2881. update(tophandle%)
  2882. getmeaning
  2883.  i$,l$,n$,i%
  2884.     27i$=ColumnMeaning$(caretcolumn%):l$=
  2885. i$,1):n$=
  2886. i$,2)
  2887. setwritablestring(11,n$)
  2888.     4.s%()=
  2889. :s%(0)=
  2890. "XYLRHDUV",l$):s%(2+s%(0))=
  2891. greymeaning
  2892. greymeaning
  2893.     9,g%()=
  2894.  s%(0)=1 
  2895.  MultipleX% g%(11)=
  2896. setselectgrey(3,11)
  2897. selectmeaning
  2898.     >$s%()=
  2899. :s%(0)=icon%-2:s%(icon%)=
  2900. greymeaning
  2901. putmeaning
  2902.  i$,j$
  2903. "XYLRHDUV",s%(0),1)
  2904.  i$<>"X" 
  2905.     F  i$+=
  2906. Tgetwritablestring(11)
  2907.  MultipleX% 
  2908.     I   j$=
  2909. Tgetwritablestring(11)
  2910.  j$="" i$="X0" 
  2911.  i$+=j$
  2912.     M#ColumnMeaning$(caretcolumn%)=i$
  2913. update(tophandle%)
  2914. getsave
  2915. handle%=savehandle%
  2916. setwritablestring(3,Save$(SaveType%))
  2917. setwritablestring(0,FileType$(SaveType%))
  2918. putsave
  2919. handle%=savehandle%
  2920.     Y+Save$(SaveType%)=
  2921. Tgetwritablestring(3)
  2922. getcalculate
  2923. setwritablestring(0,Calculate$)
  2924. putcalculate
  2925.     a%Calculate$=
  2926. Tgetwritablestring(0)
  2927. calculate
  2928. calculate
  2929.  j%,noerror%,calc$,pos%,n$,a$,b$,row%,i%,ds%,col%
  2930. "Hourglass_On"
  2931.  col%=caretx1% 
  2932. caretx2%
  2933.     i5 calc$=Calculate$:workhorse%()=
  2934. :pos%=
  2935. calc$,"#")
  2936.  pos%
  2937.     k=  n$=
  2938. calc$,pos%+1,1):a$=
  2939. calc$,pos%-1):b$=
  2940. calc$,pos%+2)
  2941.     l3  
  2942.  b$>=
  2943.  b$<=
  2944. "9" n$+=
  2945. b$,1):b$=
  2946. b$,2)
  2947.  n$="@" n$=
  2948.  col%
  2949.     nF  
  2950.  n$="#" calc$=a$+"row%"+b$ 
  2951.  calc$=a$+"FNTdata("+n$+",row%)"+b$
  2952.     o"  
  2953.  n$<>"#" workhorse%(
  2954.  n$)=
  2955.   pos%=
  2956. calc$,"#")
  2957.  workhorse is TRUE for columns which DON'T feature in the calculation
  2958.  noerror%=
  2959.  row%=carety1% 
  2960. carety2%
  2961.  j%=2:noerror%=
  2962.  noerror% 
  2963. data(col%,row%,
  2964.  calc$)
  2965.   j%=
  2966.  i%=0 
  2967.     {E  ds%=DataStatus%?(i%+C1%*row%):
  2968.  ds%=2 
  2969. workhorse%(i%) 
  2970. 255,"M"
  2971.     |&  j%=j% 
  2972. ((ds%=1) 
  2973. workhorse%(i%))
  2974.  j% j%=1 
  2975.  j%=0
  2976. . noerror%=
  2977. :DataStatus%?(col%+C1%*row%)=j%
  2978.  carety2%>maxrow% maxrow%=carety2%
  2979.  caretx2%>maxcolumn% maxcolumn%=caretx2%
  2980. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  2981. caretstring(11):
  2982. changed(
  2983. "Hourglass_Smash"
  2984. getoptions
  2985. ms%(3)=SaveIncludePoint%:s%(4)=SaveIncludeMove%:s%(5)=SaveOrder%:s%(6)=SaveLocal%:s%(7)=SaveBinaryColumns%
  2986. g%()=
  2987. setselectgrey(3,7)
  2988. selectoptions
  2989. s%(icon%)=
  2990. s%(icon%)
  2991. putoptions
  2992. mSaveIncludePoint%=s%(3):SaveIncludeMove%=s%(4):SaveOrder%=s%(5):SaveLocal%=s%(6):SaveBinaryColumns%=s%(7)
  2993. getmagnify
  2994. setwritable(3,Magnify)
  2995. 's%(3)=
  2996. :g%(3)=
  2997. setselectgrey(3,3)
  2998. putmagnify
  2999. Tgetwritable(3)
  3000.  i>0 Magnify=i
  3001. getbestfit
  3002. setwritable(3,BestFitYColumn%):
  3003. setwritable(5,BestFitX):
  3004. setwritable(6,BestFitY)
  3005. 's%(4)=BestFitForce%:s%(5)=
  3006. :s%(6)=
  3007. greybestfit
  3008. greybestfit
  3009. #g%(4)=
  3010. :g%(5)=s%(4):g%(6)=g%(5)
  3011. setselectgrey(4,6)
  3012. selectbestfit
  3013. s%(icon%)=
  3014. s%(icon%)
  3015. greybestfit
  3016. putbestfit
  3017.  A$,B$,pk1,pk2
  3018. XBestFitYColumn%=
  3019. Tgetwritable(3):BestFitX=
  3020. Tgetwritable(5):BestFitY=
  3021. Tgetwritable(6)
  3022. BestFitForce%=s%(4)
  3023.  caretx2%<>caretx1% 
  3024. report("Best fit: too many destination columns"):
  3025. (x%=-1:y%=-1:A$="Y"+
  3026.  BestFitYColumn%
  3027.  MultipleX% 
  3028.   i%=-1
  3029.   i%+=1
  3030.   i$=ColumnMeaning$(i%)
  3031.  i%=C% 
  3032.  i$=A$
  3033.  i$=A$ y%=i%
  3034.  y%>-1 
  3035. ,    i%=-1:ii%=ColumnX%(y%):A$="X"+
  3036. (ii%)
  3037.         
  3038.     i%+=1
  3039.     i$=ColumnMeaning$(i%)
  3040.  i%=C% 
  3041.  i$=A$
  3042. 9    
  3043.  i$=A$ x%=i%:ColumnX%(caretcolumn%)=ColumnX%(y%)
  3044.  i%=0 
  3045.   i$=ColumnMeaning$(i%)
  3046.  x%=-1 
  3047. i$="X" x%=i%
  3048.  y%=-1 
  3049. i$="Y"+
  3050.  BestFitYColumn% y%=i%
  3051.  x%=-1 
  3052. report("Best fit: no X column"):
  3053.  y%=-1 
  3054. report("Best fit: no Y column"):
  3055. $s%=0:sx=0:sy=0:sxx=0:sxy=0:syy=0
  3056.  i%=carety1% 
  3057. carety2%
  3058.  DataStatus%?(x%+C1%*i%)=1 
  3059. DataStatus%?(y%+C1%*i%)=1 
  3060. * s%+=1:x=
  3061. Tdata(x%,i%):y=
  3062. Tdata(y%,i%)
  3063.  ScalingXLog% 
  3064.  x>0 x=
  3065. report("Best fit: bad log"):
  3066.  ScalingYLog% 
  3067.  y>0 y=
  3068. report("Best fit: bad log"):
  3069. + sx+=x:sy+=y:sxx+=x*x:sxy+=x*y:syy+=y*y
  3070.  s%<2 
  3071. report("Best fit: not enough points"):
  3072.  BestFitForce% 
  3073. $ h=BestFitX:
  3074.  ScalingXLog% h=
  3075. $ k=BestFitY:
  3076.  ScalingYLog% k=
  3077. 1 m=(sxy-k*sx-h*sy+s%*h*k)/(sxx-2*h*sx+s%*h*h)
  3078.  c=k-m*h
  3079. $ m=(sxy*s%-sx*sy)/(s%*sxx-sx*sx)
  3080.  c=(sy-m*sx)/s%
  3081.  i%=carety1% 
  3082. carety2%
  3083. 'DataStatus%?(caretcolumn%+C1%*i%)=0
  3084.  DataStatus%?(x%+C1%*i%)=1 
  3085. Tdata(x%,i%):
  3086.  ScalingXLog% x=
  3087. ! y=m*x+c:
  3088.  ScalingYLog% y=
  3089. data(caretcolumn%,i%,y)
  3090. ( DataStatus%?(caretcolumn%+C1%*i%)=1
  3091.  caretcolumn%>maxcolumn% maxcolumn%=caretcolumn%
  3092. redrawmain(caretcolumn%,caretcolumn%,carety1%,carety2%)
  3093. caretstring(11):
  3094. changed(
  3095.  ScalingXLog% 
  3096.  ScalingYLog% 
  3097.   pk1=
  3098. -  A$ = "y = "+
  3099. (pk1)+" * (x ** "+
  3100. (m)+")"
  3101. )  A$ = "y = "+
  3102. (m)+" * LN(x) + "+
  3103.  ScalingYLog% 
  3104.   pk1=
  3105. /  A$ = "y = "+
  3106. (pk1)+" * EXP("+
  3107. (m)+" * x)"
  3108. %  A$ = "y = "+
  3109. (m)+" * x + "+
  3110. handle%=corrnhandle%
  3111. setwritablestring(3,A$)
  3112.  BestFitForce% 
  3113.  B$="Not applicable"
  3114. < pk2 = (sxy*s%-sx*sy)/
  3115. ( (sxx*s%-sx*sx)*(syy*s%-sy*sy) )
  3116. (pk2)
  3117. setwritablestring(4,B$)
  3118. update(corrnhandle%)
  3119. openwindow(corrnhandle%)
  3120. getfonts
  3121. setwritablestring(0,FontsPoints$)
  3122. setwritablestring(3,FontsLabels$)
  3123. putfonts
  3124. 'FontsPoints$=
  3125. Tgetwritablestring(0)
  3126. 'FontsLabels$=
  3127. Tgetwritablestring(3)
  3128. Tcheckfont(FontsPoints$) 
  3129. report("Warning: the font for data points is absent!")
  3130. Tcheckfont(FontsLabels$) 
  3131. report("Warning: the font for graph labels is absent!")
  3132. getweed
  3133. setwritable(3,WeedGap%)
  3134. s%()=
  3135. :s%(6)=WeedSelection%
  3136. greyweed
  3137. greyweed
  3138. g%()=
  3139. setselectgrey(3,6)
  3140. selectweed
  3141.  gap%
  3142.  icon% 
  3143.  select
  3144.  s%(6)=
  3145. s%(6)
  3146.  arrow icons
  3147. ,. gap%=
  3148. Tgetwritable(3)-(icon%=4)+(icon%=5)
  3149.  gap%<1 gap%=1
  3150.  gap%>99 gap%=99
  3151. setwritable(3,gap%)
  3152. "Wimp_ForceRedraw",handle%,220,-60,280,0
  3153. putweed
  3154. WeedGap%=
  3155. Tgetwritable(3)
  3156. WeedSelection%=s%(6)
  3157.  WeedGap%<1 WeedGap%=1
  3158. doweed
  3159. getimport
  3160. setwritable(5,ImportNumber%):
  3161. setwritable(6,ImportGap%)
  3162. setwritable(7,ImportRow%):
  3163. setwritable(8,ImportCol%)
  3164. s%()=
  3165. :s%(4)=ImportGet%
  3166. greyimport
  3167. greyimport
  3168. g%()=
  3169. :g%(5)=
  3170. s%(4)
  3171. setselectgrey(4,8)
  3172. selectimport
  3173.  icon%=4 
  3174.  s%(4)=
  3175. s%(4)
  3176. greyimport
  3177. putimport
  3178. O>ImportNumber%=
  3179. Tgetwritable(5):ImportGap%=
  3180. Tgetwritable(6)
  3181. P;ImportRow%=
  3182. Tgetwritable(7):ImportCol%=
  3183. Tgetwritable(8)
  3184. ImportGet%=s%(4)
  3185.  ImportNumber%<1 ImportNumber%=1
  3186.  ImportGap%<1 ImportGap%=1
  3187. getdownto
  3188. setwritable(3,maxrow%)
  3189. s%()=
  3190. greydownto
  3191. greydownto
  3192. g%()=
  3193. setselectgrey(3,5)
  3194. selectdownto
  3195.  gap%
  3196.  icon% 
  3197.  arrow icons
  3198. e. gap%=
  3199. Tgetwritable(3)-(icon%=4)+(icon%=5)
  3200.  gap%<0 gap%=0
  3201.  gap%>P% gap%=P%
  3202. setwritable(3,gap%)
  3203. "Wimp_ForceRedraw",handle%,220,-60,280,0
  3204. putdownto
  3205.  end%
  3206. end%=
  3207. Tgetwritable(3)
  3208. highlight(caretcolumn%,caretcolumn%,0,end%)
  3209. getmany
  3210. setwritablestring(3,ManyChoice$):
  3211. setwritablestring(4,ManyTag$)
  3212. s%()=
  3213. greymany
  3214. greymany
  3215. g%()=
  3216. setselectgrey(3,4)
  3217. putmany
  3218.  i%,col%,i$,j$,i1%,i2%,t$
  3219. FManyChoice$=
  3220. Tgetwritablestring(3):ManyTag$=
  3221. Tgetwritablestring(4)
  3222. t$=ManyTag$:i%=
  3223. t$,"#")
  3224. " t$=
  3225. i$,i%-1)+"col%"+
  3226. t$,i%+1)
  3227. t$,"#")
  3228.  t$="" t$="-1"
  3229. i$=ManyChoice$
  3230. i$,1)=" ":i$=
  3231. i$,2):
  3232. i$)=" ":i$=
  3233.  i$="" i$="FALSE"
  3234. i$,"#")
  3235. (i$="TRUE" 
  3236. i$="FALSE") 
  3237. #  i$=
  3238. i$,i%-1)+"col%"+
  3239. i$,i%+1)
  3240.   i%=
  3241. i$,"#")
  3242.  col%=0 
  3243. manycopy(col%,caretcolumn%,t$)
  3244.   i%=
  3245. i$,",")
  3246.  i% j$=
  3247. i$,i%-1):i$=
  3248. i$,i%+1) 
  3249.  j$=i$:i$=""
  3250.   i%=
  3251. j$,"-")
  3252.  i% i1%=
  3253. j$,i%-1):i2%=
  3254. j$,i%+1) 
  3255.  i1%=
  3256.  j$:i2%=i1%
  3257.  col%=i1% 
  3258. manycopy(col%,caretcolumn%,t$)
  3259.  i$=""
  3260. update(tophandle%)
  3261. manycopy(col%,s%,t$)
  3262.  i%,i$
  3263. ColumnMeaning$(s%),1)
  3264.  i%>=0 
  3265. i%<100 
  3266. i$<>"X" i$+=
  3267. ColumnMeaning$(col%)=i$
  3268. %ColumnThick(col%)=ColumnThick(s%)
  3269. #ColumnDash(col%)=ColumnDash(s%)
  3270. !ColumnGap(col%)=ColumnGap(s%)
  3271. /ColumnErrorThick(col%)=ColumnErrorThick(s%)
  3272. +ColumnErrorCap(col%)=ColumnErrorCap(s%)
  3273. %ColumnWidth(col%)=ColumnWidth(s%)
  3274. 'ColumnHeight(col%)=ColumnHeight(s%)
  3275. %ColumnChar%(col%)=ColumnChar%(s%)
  3276. +ColumnKeyText$(col%)=ColumnKeyText$(s%)
  3277. )ColumnColour%(col%)=ColumnColour%(s%)
  3278. %ColumnPlot%(col%)=ColumnPlot%(s%)
  3279. %ColumnLine%(col%)=ColumnLine%(s%)
  3280. 'ColumnError%(col%)=ColumnError%(s%)
  3281. )ColumnPoints%(col%)=ColumnPoints%(s%)
  3282. %ColumnFill%(col%)=ColumnFill%(s%)
  3283. +ColumnLinecol%(col%)=ColumnLinecol%(s%)
  3284. +ColumnCharcol%(col%)=ColumnCharcol%(s%)
  3285. /ColumnLinestyle%(col%)=ColumnLinestyle%(s%)
  3286. %ColumnDash2(col%)=ColumnDash2(s%)
  3287. ColumnX%(col%)=ColumnX%(s%)
  3288. getworksheet
  3289. setwritable(3,C1%):
  3290. setwritable(4,P1%)
  3291. setwritablestring(5,""):
  3292. setwritablestring(6,"")
  3293. s%()=
  3294. greyworksheet
  3295. greyworksheet
  3296. g%()=
  3297. setselectgrey(3,6)
  3298. putworksheet
  3299.  i$,j$
  3300. CnewC1%=
  3301. Tgetwritablestring(5):newP1%=
  3302. Tgetwritablestring(6)
  3303.  newC1%=0 
  3304. newP1%=0 
  3305.  newC1%=0 
  3306.  newP1%<minP1% newP1%=minP1%
  3307. 8 newC1%=room% 
  3308.  newP1%:
  3309.  newC1%>maxC1% newC1%=maxC1%
  3310.  newP1%=0 newP1%=room% 
  3311.  newC1%
  3312.  newP1%<minP1% newP1%=minP1%
  3313.  newC1%<2 
  3314. report("That gives less than 2 columns!"):
  3315.  newC1%>maxC1% 
  3316. report("The maximum number of columns is "+
  3317.  maxC1%+"!"):
  3318.  newC1%<>C1% 
  3319. newP1%<=maxrow% 
  3320.  changed% 
  3321. Tjeopardy 
  3322. cleardata
  3323. +C1%=newC1%:P1%=newP1%:C%=C1%-1:P%=P1%-1
  3324. setextent
  3325. update(tophandle%)
  3326.  caretx2%<>caretx1% 
  3327. report("Sort: too many destination columns"):
  3328.  carety2%=carety1% 
  3329. report("Sort: not enough points"):
  3330. "Hourglass_On"
  3331. (s%=caretcolumn%:n%=carety2%-carety1%
  3332.  i%=carety1% 
  3333. carety2%-1
  3334.  n%>100 
  3335. 10=0 
  3336. "Hourglass_Percentage",
  3337. (100.0*
  3338. (i%/n%))
  3339.  any%=
  3340. :I=0:k%=-1
  3341.  j%=i% 
  3342. carety2%
  3343.  DataStatus%?(s%+C1%*j%)=1 
  3344. Tdata(s%,j%)<I 
  3345. any%=
  3346. Tdata(s%,j%):k%=j%:any%=
  3347.  any% 
  3348. (k%<>i%) 
  3349.  l%=0 
  3350. @   I=
  3351. Tdata(l%,i%):
  3352. data(l%,i%,
  3353. Tdata(l%,k%)):
  3354. data(l%,k%,I)
  3355. l   I%=DataStatus%?(l%+C1%*i%):DataStatus%?(l%+C1%*i%)=DataStatus%?(l%+C1%*k%):DataStatus%?(l%+C1%*k%)=I%
  3356. "Hourglass_Smash"
  3357. getmaininfo:
  3358. redrawmain(lcolumn%,rcolumn%,trow%,brow%)
  3359. caretstring(11):
  3360. changed(
  3361. normalise
  3362.  i%,j%,m
  3363. "Hourglass_On":m=0
  3364.  i%=caretx1% 
  3365. caretx2%:
  3366.  j%=carety1% 
  3367. carety2%
  3368.  DataStatus%?(i%+C1%*j%)=1 
  3369. Tdata(i%,j%)>m m=
  3370. Tdata(i%,j%)
  3371.  m=0 
  3372. "Hourglass_Smash":
  3373. report("Can't normalise by zero!"):
  3374.  i%=caretx1% 
  3375. caretx2%:
  3376.  j%=carety1% 
  3377. carety2%
  3378. data(i%,j%,
  3379. Tdata(i%,j%)/m)
  3380. redrawmain(caretx1%,caretx2%,carety1%,carety2%)
  3381. caretstring(11):
  3382. changed(
  3383. "Hourglass_Smash"
  3384. defaultsavevars
  3385.  DrawFile,file_aff,TauFile,file_082,TauStyle,file_083,CSVFile,file_dfe,TextFile,file_fff,DataFile,file_ffd
  3386.  i%=0 
  3387.  Save$(i%),FileType$(i%):
  3388. OldSave$()=Save$()
  3389. *SaveIncludePoint%=
  3390. :SaveIncludeMove%=
  3391. 2SaveOrder%=
  3392. :SaveLocal%=
  3393. :SaveBinaryColumns%=
  3394. defaultvars
  3395. *DrawFrame%=
  3396. :DrawXAxis%=
  3397. :DrawYAxis%=
  3398.  FrameThick=0.6:AxisThick=0.6
  3399.  v1.50
  3400. <FrameFill%=
  3401. :FrameFillColour%=lgrey%:FrameColour%=black%
  3402. &KeyBack%=white%:KeyOutline%=black%
  3403. QTicksMajorXFrame%=
  3404. :TicksMajorYFrame%=
  3405. :TicksMajorXAxis%=
  3406. :TicksMajorYAxis%=
  3407. QTicksMinorXFrame%=
  3408. :TicksMinorYFrame%=
  3409. :TicksMinorXAxis%=
  3410. :TicksMinorYAxis%=
  3411. jTicksMajorIn=10:TicksMajorOut=0:TicksMajorDown=10:TicksMajorUp=10:TicksMajorLeft=10:TicksMajorRight=10
  3412. eTicksMinorIn=5:TicksMinorOut=0:TicksMinorDown=5:TicksMinorUp=5:TicksMinorLeft=5:TicksMinorRight=5
  3413. +TicksMajorThick=0.2:TicksMinorThick=0.2
  3414. ?GridsMajorX%=
  3415. :GridsMajorY%=
  3416. :GridsMinorX%=
  3417. :GridsMinorY%=
  3418. *GridsDash=1:GridsGap=3:GridsThick=0.05
  3419. ALabelsXFrame%=
  3420. :LabelsXAxis%=
  3421. :LabelsBelow%=
  3422. :LabelsXMinor%=
  3423. QLabelsYFrame%=
  3424. :LabelsYAxis%=
  3425. :LabelsLeft%=
  3426. :LabelsYMinor%=
  3427. :LabelsYRotate%=
  3428. (LabelsXOffset=0.25:LabelsYOffset=0.5
  3429.  QFontsLabels$="Homerton.Medium.Oblique":LabelsFontWidth=18:LabelsFontHeight=18
  3430. !IAxistextXPlot%=
  3431. :AxistextYPlot%=
  3432. :AxistextXFrame%=
  3433. :AxistextYFrame%=
  3434. "6AxistextBelow%=
  3435. :AxistextLeft%=
  3436. :AxistextRotate%=
  3437. #UAxistextXOffset=0.5:AxistextYOffset=0.5:AxistextXSpacing=1.2:AxistextYSpacing=1.2
  3438. $]AxistextXText$="Horizontal text\(x variable)":AxistextYText$="Vertical text\(y variable)"
  3439. %.AxistextFontWidth=18:AxistextFontHeight=18
  3440. &GGraphWidth=5:GraphHeight=4:GraphLeft=2:GraphBottom=2:GraphBorder%=
  3441. 'PGraphBorderWidth=7:GraphBorderHeight=6:GraphBorderLeft=1:GraphBorderBottom=1
  3442. (,GraphKey%=
  3443. :GraphKeyLeft=8:GraphKeyTop=6
  3444. )"ScalingAuto%=
  3445. :ScalingBound%=
  3446. *!ScalingXLog%=
  3447. :ScalingYLog%=
  3448. +1ScalingXMin=1:ScalingXMax=2:ScalingXAtYAxis=1
  3449. ,1ScalingYMin=1:ScalingYMax=2:ScalingYAtXAxis=1
  3450. -KScalingXDigits%=3:ScalingYDigits%=3:ScalingXFormat%=0:ScalingYFormat%=0
  3451. .8ScalingXMajor=0.5:ScalingXMinor=0.1:ScalingXAnchor=0
  3452. /8ScalingYMajor=0.5:ScalingYMinor=0.1:ScalingYAnchor=0
  3453. 0)ScalingXLogType%=1:ScalingYLogType%=1
  3454. 1<ColumnPlot%()=
  3455. :ColumnMeaning$(0)="X":ColumnChar%(0)=108
  3456.  i%=1 
  3457. maxC1%-1:ColumnMeaning$(i%)="Y"+
  3458.  i%:ColumnChar%(i%)=108+i% 
  3459. 3%ColumnKeyText$()=ColumnMeaning$()
  3460. 4bColumnLine%()=
  3461. :ColumnThick()=0.6:ColumnDash()=6:ColumnGap()=0:ColumnDash2()=6:ColumnFill%()=
  3462. 56ColumnPoints%()=
  3463. :ColumnWidth()=8:ColumnHeight()=8
  3464. 6?ColumnError%()=
  3465. :ColumnErrorThick()=0.6:ColumnErrorCap()=10
  3466. 7SColumnLinecol%()=black%:ColumnCharcol%()=black%:linecol%=black%:charcol%=black%
  3467. 8(ColumnLinestyle%()=0:ColumnDash2()=0
  3468. ColumnX%()=0
  3469. :;BestFitYColumn%=1:BestFitForce%=
  3470. :BestFitX=0:BestFitY=0
  3471. ;)FontsPoints$="Selwyn":Calculate$="##"
  3472. <7Magnify=1:JeopardyWarning%=
  3473. :ColumnColour%()=lgrey%
  3474. WeedGap%=2:WeedSelection%=
  3475. > ImportGet%=
  3476. :ImportNumber%=2
  3477. ?*ImportGap%=1:ImportRow%=0:ImportCol%=0
  3478. ManyChoice$="":ManyTag$="#"
  3479. MultipleX%=
  3480. suffix%=
  3481. autoscale
  3482.  x%,min,max,minb,maxb,i%,y%,ii%,ok%
  3483. ScalingAuto% 
  3484. 255,"shouldn't be autoscaling"
  3485. x%=-1:min=0:max=0
  3486. :ii%=0
  3487. :x%+=1
  3488. L4i%=ColumnPlot%(x%) 
  3489. ColumnMeaning$(x%),1)="X")
  3490. (x%=maxcolumn%)
  3491. Tmaxmin(x%,min,max)
  3492.  MultipleX% 
  3493.  ii%=0 
  3494. R$   ii%=1:minb=min:maxb=max:ok%=
  3495.  min>minb min=minb
  3496.  max<maxb max=maxb
  3497.  MultipleX%) 
  3498.   (x%=maxcolumn%)
  3499.  MultipleX% i%=ok%
  3500. \< ScalingXMin=min:ScalingXMax=max:
  3501.  min<=0 ScalingXLog%=
  3502.  ScalingXLog% 
  3503. autolog(ScalingXMin,ScalingXMax,ScalingXLogType%)
  3504.  ScalingXLogType%=-1 
  3505. autolin(ScalingXMin,ScalingXMax,ScalingXMajor,ScalingXMinor,ScalingXAnchor,
  3506. autolin(ScalingXMin,ScalingXMax,ScalingXMajor,ScalingXMinor,ScalingXAnchor,
  3507. cD ScalingXAtYAxis=ScalingXMin:ScalingXDigits%=3:ScalingXFormat%=0
  3508. y%=-1:i%=
  3509. :min=0:max=0
  3510.  y%<maxcolumn%
  3511. :y%+=1
  3512. h5ii%=ColumnPlot%(y%) 
  3513. ColumnMeaning$(y%),1)="Y")
  3514.  ii% 
  3515. (y%=maxcolumn%)
  3516.  ii% ii%=
  3517. Tmaxmin(y%,min,max)
  3518.  ii% 
  3519.  min<ScalingYMin ScalingYMin=min
  3520.  max>ScalingYMax ScalingYMax=max
  3521. p%  ScalingYMin=min:ScalingYMax=max
  3522. i%=i% 
  3523.  ScalingYMin<=0 ScalingYLog%=
  3524.  ScalingYLog% 
  3525. autolog(ScalingYMin,ScalingYMax,ScalingYLogType%)
  3526.  ScalingYLogType%=-1 
  3527. autolin(ScalingYMin,ScalingYMax,ScalingYMajor,ScalingYMinor,ScalingYAnchor,
  3528. autolin(ScalingYMin,ScalingYMax,ScalingYMajor,ScalingYMinor,ScalingYAnchor,
  3529. }D ScalingYAtXAxis=ScalingYMin:ScalingYDigits%=3:ScalingYFormat%=0
  3530. Tmaxmin(column%,
  3531.  min,
  3532.  max)
  3533. valid%=
  3534. :min=0:max=0
  3535.  j%=0 
  3536. maxrow%
  3537. Tdata(column%,j%)
  3538.  DataStatus%?(column%+C1%*j%)=1 
  3539.  valid% 
  3540.  D>max max=D
  3541.  D<min min=D
  3542.   valid%=
  3543.   min=D:max=D
  3544.  min=max 
  3545.  min 
  3546. 0:max=1
  3547. -1:min=2*min
  3548. 1:max=2*max
  3549. =valid%
  3550. autolog(
  3551.  min,
  3552.  max,
  3553.  type%)
  3554. $min=10^
  3555.  min:max=10^
  3556.  max+1)
  3557. type%=3
  3558.  max/min<1E6 type%=2
  3559.  max/min<100 type%=1
  3560.  max/min<20 type%=0
  3561.  max/min<10 type%=-1
  3562. autolin(
  3563.  min,
  3564.  max,
  3565.  major,
  3566.  minor,
  3567.  anchor,allowminmaxtochange%)
  3568. 3xr=(max-min)/2:xl=10^(
  3569.  xr):j%=
  3570. (xr/xl+0.001)
  3571.  j%>4 major=5*xl:minor=xl 
  3572.  j%>1 major=2*xl:minor=xl 
  3573.  major=xl:minor=xl/2
  3574.  allowminmaxtochange% min=
  3575. (min/major+0.001)*major:max=
  3576. (max/major-0.001+1)*major
  3577. anchor=min
  3578.  ##### generation of graph as a Draw file #####
  3579. Tgenerate(memory%)
  3580.  buffer%,newsize%,overflow%,ptr%
  3581.  output file already opened with handle c% if memory% is FALSE
  3582.  if memory% is TRUE, then write file to memory above HIMEM
  3583. overflow%=
  3584.  memory% 
  3585.  buffer%=64*1024
  3586. "Wimp_SlotSize",MinSlotSize%+buffer%,-1 
  3587.  newsize%
  3588.  newsize%<>MinSlotSize%+buffer% =0
  3589.  ptr%=0
  3590. ?point%=640:pointsininch%=72:point=point%*Magnify:drawn%()=
  3591.  importdrawfile% 
  3592.  importdrawfile%=
  3593. "OS_File",5,file$ 
  3594.  ,,,,ptr%
  3595. "Load "+file$+" "+
  3596. ~Himem%
  3597. startdrawfile
  3598. fonttable
  3599. startgroup(1)
  3600.  GraphBorder% 
  3601. GraphKey% 
  3602. startgroup(2)
  3603.  FrameFill% 
  3604. fillback
  3605. plots
  3606.  overflow% 
  3607.  DrawFrame% 
  3608. frame
  3609.  DrawXAxis% 
  3610. xaxis
  3611.  DrawYAxis% 
  3612. yaxis
  3613. xmarks
  3614. ymarks
  3615.  AxistextXPlot% 
  3616. xtext
  3617.  AxistextYPlot% 
  3618. ytext
  3619.  GraphBorder% 
  3620. GraphKey% 
  3621. endgroup(2)
  3622.  GraphKey% 
  3623. startgroup(3):
  3624. graphkey:
  3625. endgroup(3)
  3626.  GraphBorder% 
  3627. border
  3628. endgroup(1)
  3629. boundgroups
  3630. enddrawfile
  3631.  overflow% 
  3632.     =ptr%
  3633. plots
  3634.  x%,i%
  3635.  MultipleX% 
  3636.   x%=
  3637. Txcolumn:
  3638.  x%<0 
  3639.  i%=0 
  3640. ColumnMeaning$(i%),1)="Y") 
  3641. ColumnPlot%(i%) 
  3642. ycolumn(i%)
  3643.  i%=0 
  3644. ColumnMeaning$(i%),1)="Y") 
  3645. ColumnPlot%(i%) 
  3646.     x%=ColumnX%(i%)
  3647.      
  3648. Tokx(x%) 
  3649. ycolumn(i%)
  3650. Tokx(
  3651.  xx%,i%
  3652. xx%=-1
  3653. xx%+=1
  3654. Zi%= (
  3655. ColumnMeaning$(xx%),1)="X") 
  3656.  ColumnPlot%(xx%) 
  3657. ColumnMeaning$(xx%),2))=x%)
  3658.  xx%=C% 
  3659.  i% x%=xx%
  3660. Txcolumn
  3661.  x%,i%
  3662. x%=-1:i%=-1
  3663.     i%+=1
  3664.  only use column i% if its ColumnPlot% is TRUE
  3665. ColumnMeaning$(i%),1)="X") 
  3666. ColumnPlot%(i%) x%=i%
  3667.  i%=C% 
  3668. x%<>-1
  3669. ycolumn(y%)
  3670.  column$,validpoints%,j%,L%,R%,U%,D%,k%,type%
  3671.  global x%
  3672. linecol%=ColumnLinecol%(y%)
  3673. charcol%=ColumnCharcol%(y%)
  3674.  column$=
  3675. ColumnMeaning$(y%))
  3676. validpoints%=0
  3677.  j%=0 
  3678. maxrow%
  3679.  DataStatus%?(x%+C1%*j%)=1 
  3680. DataStatus%?(y%+C1%*j%)=1 validpoints%+=1
  3681.  ColumnFill%(y%) 
  3682. (validpoints%>1) 
  3683. ScalingYLog% 
  3684. ScalingBound% 
  3685. line(ColumnColour%(y%)):drawn%(y%)=
  3686.  ColumnLine%(y%) 
  3687. (validpoints%>1) 
  3688. (ColumnDash(y%)>0) 
  3689. line(-1):drawn%(y%)=
  3690.  ColumnError%(y%) 
  3691. validpoints% 
  3692.  error bars
  3693.  L%=-1:R%=-1:U%=-1:D%=-1
  3694.  k%=0 
  3695. (column$=
  3696. ColumnMeaning$(k%))) 
  3697. ColumnPlot%(k%) 
  3698.  only use column k% if its ColumnPlot% is TRUE
  3699. -  type%=
  3700. "HLRVDU",
  3701. ColumnMeaning$(k%),1))
  3702.  type% 
  3703.  L%=-1 L%=k%
  3704.  R%=-1 R%=k%
  3705.  L%=-1 L%=k%
  3706.  R%=-1 R%=k%
  3707.  D%=-1 D%=k%
  3708.  U%=-1 U%=k%
  3709.  D%=-1 D%=k%
  3710.  U%=-1 U%=k%
  3711.  L%+R%+D%+U%<>-4 
  3712. errorbars:drawn%(y%)=
  3713.  ColumnPoints%(y%) 
  3714. validpoints% 
  3715. points:drawn%(y%)=
  3716. line(fill%)
  3717.  start%,possiblestart%,oldin%,ox,oy,j%,x,y,in%,option%,x1,y1,x2,y2,xx,yy,localbound%
  3718. linecol%=ColumnLinecol%(y%)
  3719.  there is a line to be plotted for data column x%,y%
  3720.  Qstart%=
  3721. :possiblestart%=
  3722. :localbound%=ScalingBound%:
  3723.  fill%<>-1 localbound%=
  3724.  localbound% 
  3725.  oldin%=
  3726. :ox=0:oy=0
  3727.  j%=0 
  3728. maxrow%
  3729. (DataStatus%?(x%+C1%*j%)=2 
  3730. DataStatus%?(y%+C1%*j%)=2) 
  3731. ,7  in%=
  3732. :oldin%=
  3733. :possiblestart%=
  3734.  start% 
  3735. endpath
  3736.   start%=
  3737.  DataStatus%?(x%+C1%*j%)=1 
  3738. DataStatus%?(y%+C1%*j%)=1 
  3739. 0%  x=
  3740. Tdata(x%,j%):y=
  3741. Tdata(y%,j%)
  3742. 1P  in%=(x>=ScalingXMin) 
  3743. (x<=ScalingXMax) 
  3744. (y>=ScalingYMin) 
  3745. (y<=ScalingYMax)
  3746. 2$  option%=-4*in%-2*oldin%-start%
  3747.  option% 
  3748.  both points are in, path in progress, join them
  3749. draw(
  3750. Tx(x),
  3751. Ty(y))
  3752.  this point is in, previous point in, path not in progress but must have been declared possible: start, move to old, draw to current
  3753. 7E   
  3754. linestartpath(j%):
  3755. move(
  3756. Tx(ox),
  3757. Ty(oy)):
  3758. draw(
  3759. Tx(x),
  3760. Ty(y))
  3761.  this point is in, the last one was out, path in progress, join them
  3762. 9G   
  3763. crossing(ox,oy,x,y):
  3764. move(
  3765. Tx(xx),
  3766. Ty(yy)):
  3767. draw(
  3768. Tx(x),
  3769. Ty(y))
  3770.  this point is in, last was out, path not started
  3771.  possiblestart% 
  3772. <.    
  3773.  start up, do crossing, move and draw
  3774. =\     
  3775. linestartpath(j%):
  3776. crossing(ox,oy,x,y):
  3777. move(
  3778. Tx(xx),
  3779. Ty(yy)):
  3780. draw(
  3781. Tx(x),
  3782. Ty(y))
  3783. >        
  3784. ?3     
  3785.  point is in, so possible start of a line
  3786.      possiblestart%=
  3787.  this point is out, the last one was in, path in progress, join them
  3788. C2   
  3789. crossing(x,y,ox,oy):
  3790. draw(
  3791. Tx(xx),
  3792. Ty(yy))
  3793.  this point is out, last was in, must be a possible start
  3794. E\   
  3795. linestartpath(j%):
  3796. crossing(x,y,ox,oy):
  3797. move(
  3798. Tx(ox),
  3799. Ty(oy)):
  3800. draw(
  3801. Tx(xx),
  3802. Ty(yy))
  3803.  this point is out, the last one was out, path in progress, join them?
  3804. GA   
  3805. Tinandout 
  3806. move(
  3807. Tx(x1),
  3808. Ty(y1)):
  3809. draw(
  3810. Tx(x2),
  3811. Ty(y2))
  3812.  this point is out, last point out
  3813.  possiblestart% 
  3814. JD     
  3815.  if there is a line, start up and draw it, else do nothing
  3816. KV     
  3817. Tinandout 
  3818. linestartpath(j%):
  3819. move(
  3820. Tx(x1),
  3821. Ty(y1)):
  3822. draw(
  3823. Tx(x2),
  3824. Ty(y2))
  3825.      
  3826.      possiblestart%=
  3827. N        
  3828. 255,"banjaxed"
  3829.   ox=x:oy=y:oldin%=in%
  3830.  start% 
  3831. endpath
  3832.  j%=0 
  3833. maxrow%
  3834. (DataStatus%?(x%+C1%*j%)=2 
  3835. DataStatus%?(y%+C1%*j%)=2) 
  3836. start% 
  3837.  fill%<>-1 
  3838. draw(
  3839. Tx(x),
  3840. Ty(0))
  3841.   start%=
  3842. endpath
  3843.  DataStatus%?(x%+C1%*j%)=1 
  3844. DataStatus%?(y%+C1%*j%)=1 
  3845. _%  x=
  3846. Tdata(x%,j%):y=
  3847. Tdata(y%,j%)
  3848.  start% 
  3849. draw(
  3850. Tx(x),
  3851. Ty(y))
  3852. linestartpath(j%)
  3853.  start% 
  3854. eT    
  3855.  fill%<>-1 
  3856. move(
  3857. Tx(x),
  3858. Ty(0)):
  3859. draw(
  3860. Tx(x),
  3861. Ty(y)) 
  3862. move(
  3863. Tx(x),
  3864. Ty(y))
  3865.  start% 
  3866.  fill%<>-1 
  3867. draw(
  3868. Tx(x),
  3869. Ty(0))
  3870. endpath
  3871. linestartpath(pt%)
  3872.  start% 
  3873. 255,"Don't call PROClinestartpath if already started!"
  3874.  localbound% 
  3875.  do test as per usual if no bounds checking
  3876.  pt%>=maxrow% 
  3877.   pt%+=1
  3878.  DataStatus%?(x%+C1%*pt%)=1 
  3879. DataStatus%?(y%+C1%*pt%)=1 start%=
  3880.  DataStatus%?(x%+C1%*pt%)=2 
  3881. DataStatus%?(y%+C1%*pt%)=2 pt%=maxrow%
  3882.  start% 
  3883. (pt%=maxrow%)
  3884. start% 
  3885.   already checked if localbound%=TRUE
  3886.  start%=
  3887.  fill%<>-1 
  3888.  ScalingYLog% 
  3889. report("Can't do a log fill graph (no zero!)")
  3890. startpathfill(-1,0,fill%)
  3891.  ColumnGap(y%)=0 
  3892. startpath(ColumnThick(y%),0,0,0,0)
  3893. startpath(ColumnThick(y%),128,ColumnDash(y%),ColumnGap(y%),ColumnDash2(y%))
  3894. crossing(xout,yout,xin,yin)
  3895.  yh,xv,yv
  3896.  the line between <in> and <out> leaves the frame at xx,yy
  3897.  yout>yin yh=ScalingYMax 
  3898.  yh=ScalingYMin
  3899.  xout<xin xv=ScalingXMin 
  3900.  xv=ScalingXMax
  3901.  xin=xout xx=xin:yy=yh:
  3902.  yin=yout yy=yin:xx=xv:
  3903. +yv=yout+(xv-xout)*(yin-yout)/(xin-xout)
  3904.  yv<=ScalingYMax 
  3905. yv>=ScalingYMin xx=xv:yy=yv:
  3906. 1yy=yh:xx=xout+(yh-yout)*(xin-xout)/(yin-yout)
  3907. Tinandout
  3908.  yleft,yright,xbottom,xtop,gotone%,xx,yy
  3909.  if TRUE, the line between x,y and ox,oy enters and leaves the frame at x1,y1 and x2,y2
  3910. (x<=ScalingXMin 
  3911. ox<=ScalingXMin) 
  3912. (x>=ScalingXMax 
  3913. ox>=ScalingXMax) 
  3914. (y<=ScalingYMin 
  3915. oy<=ScalingYMin) 
  3916. (y>=ScalingYMax 
  3917. oy>=ScalingYMax) =
  3918.  x=ox 
  3919.  x<ScalingXMin 
  3920.  x>ScalingXMax =
  3921.  (y-ScalingYMax)*(oy-ScalingYMax)>0 =
  3922. , x1=x:x2=x:y1=ScalingYMin:y2=ScalingYMax
  3923.  y=oy 
  3924.  y<ScalingYMin 
  3925.  y>ScalingYMax =
  3926.  (x-ScalingXMax)*(ox-ScalingXMax)>0 =
  3927. , y1=y:y2=y:x1=ScalingXMin:x2=ScalingXMax
  3928. +yleft=oy+(ScalingXMin-ox)*(y-oy)/(x-ox)
  3929. ,yright=oy+(ScalingXMax-ox)*(y-oy)/(x-ox)
  3930. -xbottom=ox+(ScalingYMin-oy)*(x-ox)/(y-oy)
  3931. *xtop=ox+(ScalingYMax-oy)*(x-ox)/(y-oy)
  3932. gotone%=
  3933.  yleft>=ScalingYMin 
  3934. yleft<=ScalingYMax 
  3935.  (y-yleft)*(yleft-oy)>=0 gotone%=
  3936. :x1=ScalingXMin:y1=yleft
  3937.  yright>=ScalingYMin 
  3938. yright<=ScalingYMax 
  3939.  (y-yright)*(yright-oy)>=0 
  3940.  xx=ScalingXMax:yy=yright
  3941.  gotone% x2=xx:y2=yy:=
  3942.  gotone%=
  3943. :x1=xx:y1=yy
  3944.  xbottom>=ScalingXMin 
  3945. xbottom<=ScalingXMax 
  3946.  (x-xbottom)*(xbottom-ox)>=0 
  3947.  xx=xbottom:yy=ScalingYMin
  3948.  gotone% x2=xx:y2=yy:=
  3949.  gotone%=
  3950. :x1=xx:y1=yy
  3951.  xtop>=ScalingXMin 
  3952. xtop<=ScalingXMax 
  3953.  (x-xtop)*(xtop-ox)>=0 
  3954. gotone% x2=xtop:y2=ScalingYMax:=
  3955. points
  3956.  i$,fonthandle%,bx1%,by1%,bx2%,by2%,d%,x,y
  3957.  there are points to be plotted for data column x%,y%
  3958.  ColumnChar%(y%)
  3959. pointlength(y%)
  3960. charcol%=ColumnCharcol%(y%)
  3961.  d%=0 
  3962. maxrow%
  3963. Tdata(x%,d%):y=
  3964. Tdata(y%,d%)
  3965.  DataStatus%?(x%+C1%*d%)=1 
  3966. DataStatus%?(y%+C1%*d%)=1 
  3967. ((x>=ScalingXMin 
  3968. x<=ScalingXMax 
  3969. y>=ScalingYMin 
  3970. y<=ScalingYMax) 
  3971. ScalingBound%) 
  3972. text(
  3973. Tx(x)-(x1+x2)/2,
  3974. Ty(y)-(y1+y2)/2,2,ColumnWidth(y%),ColumnHeight(y%),i$,0)
  3975. charcol%=black%
  3976. errorbars
  3977.  w,d%,x,y,start%,e
  3978.  there are probably error bars to be plotted for column x%,y%
  3979.  using column L%,R%,D%,U% (any =-1 means no error bars there)
  3980. w=ColumnErrorCap(y%)
  3981.  d%=0 
  3982. maxrow%
  3983. Tdata(x%,d%):y=
  3984. Tdata(y%,d%)
  3985.  DataStatus%?(x%+C1%*d%)=1 
  3986. DataStatus%?(y%+C1%*d%)=1 
  3987. ((x>=ScalingXMin 
  3988. x<=ScalingXMax 
  3989. y>=ScalingYMin 
  3990. y<=ScalingYMax) 
  3991. ScalingBound%) 
  3992.  start%=
  3993.  L%>=0 
  3994.  DataStatus%?(L%+C1%*d%)=1 
  3995. start% start%=
  3996. startpath(ColumnErrorThick(y%),0,0,0,0)
  3997.    e=
  3998. Tdata(L%,d%)
  3999. move(
  4000. Tx(x),
  4001. Ty(y)):
  4002. draw(
  4003. Tx(x-e),
  4004. Ty(y))
  4005.  w>0 
  4006. move(
  4007. Tx(x-e),
  4008. Ty(y)-w):
  4009. draw(
  4010. Tx(x-e),
  4011. Ty(y)+w)
  4012.  R%>=0 
  4013.  DataStatus%?(R%+C1%*d%)=1 
  4014. start% start%=
  4015. startpath(ColumnErrorThick(y%),0,0,0,0)
  4016.    e=
  4017. Tdata(R%,d%)
  4018. move(
  4019. Tx(x),
  4020. Ty(y)):
  4021. draw(
  4022. Tx(x+e),
  4023. Ty(y))
  4024.  w>0 
  4025. move(
  4026. Tx(x+e),
  4027. Ty(y)-w):
  4028. draw(
  4029. Tx(x+e),
  4030. Ty(y)+w)
  4031.  D%>=0 
  4032.  DataStatus%?(D%+C1%*d%)=1 
  4033. start% start%=
  4034. startpath(ColumnErrorThick(y%),0,0,0,0)
  4035.    e=
  4036. Tdata(D%,d%)
  4037. move(
  4038. Tx(x),
  4039. Ty(y)):
  4040. draw(
  4041. Tx(x),
  4042. Ty(y-e))
  4043.  w>0 
  4044. move(
  4045. Tx(x)-w,
  4046. Ty(y-e)):
  4047. draw(
  4048. Tx(x)+w,
  4049. Ty(y-e))
  4050.  U%>=0 
  4051.  DataStatus%?(U%+C1%*d%)=1 
  4052. start% start%=
  4053. startpath(ColumnErrorThick(y%),0,0,0,0)
  4054.    e=
  4055. Tdata(U%,d%)
  4056. move(
  4057. Tx(x),
  4058. Ty(y)):
  4059. draw(
  4060. Tx(x),
  4061. Ty(y+e))
  4062.  w>0 
  4063. move(
  4064. Tx(x)-w,
  4065. Ty(y+e)):
  4066. draw(
  4067. Tx(x)+w,
  4068. Ty(y+e))
  4069.  start% 
  4070. endpath
  4071. xmarks
  4072.  minors%,exponent%,m,mantissa%,x,y,i%,a%,i$,x1,y1,x2,y2,i,ex,ex$
  4073.  variables for label offset control
  4074. -frameup=0:framedown=0:axisup=0:axisdown=0
  4075.  DrawFrame% 
  4076. TicksMajorXFrame% 
  4077. 2 frameup=TicksMajorOut:framedown=TicksMajorOut
  4078.  TicksMinorXFrame% 
  4079. (TicksMinorOut>TicksMajorOut) frameup=TicksMinorOut:framedown=TicksMinorOut
  4080.  DrawXAxis% 
  4081. TicksMajorXAxis% 
  4082. 0 axisup=TicksMajorUp:axisdown=TicksMajorDown
  4083.  TicksMinorXAxis% 
  4084. (TicksMinorUp>TicksMajorUp) axisup=TicksMinorUp
  4085.  TicksMinorXAxis% 
  4086. (TicksMinorDown>TicksMajorDown) axisdown=TicksMinorDown
  4087.  now prepare for loop
  4088.  ScalingXLog% 
  4089.  minors%=2
  4090. @ exponent%=
  4091. (ScalingXMin*0.999):m=ScalingXMin/10^exponent%
  4092.  ScalingXLogType% 
  4093. 0,-1:
  4094.  m>5 mantissa%=1:exponent%+=1 
  4095.  m>2 mantissa%=5 
  4096.  mantissa%=2
  4097.  m>3 mantissa%=1:exponent%+=1 
  4098.  mantissa%=3
  4099. 2:mantissa%=1:
  4100.  m>1 exponent%+=1
  4101. 3:mantissa%=1:
  4102.  m>1 exponent%+=1
  4103.  exponent% 
  4104. 3 exponent%+=1:
  4105.  exponent% 
  4106. 3 exponent%+=1
  4107.  x=mantissa%*10^exponent%
  4108.  i%=1:
  4109.  mantissa%=1 i%=0
  4110.  ScalingXLogType%=-1 
  4111.  mantissa%=1 
  4112.  mantissa%=2 
  4113.  mantissa%=5 i%=0 
  4114.  i%=1
  4115. 1 minors%=
  4116. (ScalingXMajor/ScalingXMinor+0.001)
  4117. e a%=0:
  4118.  ScalingXAnchor>ScalingXMin a%=minors%*
  4119. ((ScalingXAnchor-ScalingXMin)/ScalingXMajor+1.001)
  4120.  i%=-1
  4121. :i%+=1:x=ScalingXAnchor+(i%-a%)*ScalingXMajor/minors%:
  4122.  x>=ScalingXMin
  4123. linecol%=FrameColour%
  4124. charcol%=FrameColour%
  4125.  x<=ScalingXMax
  4126.  grids
  4127. ((i% 
  4128.  minors%=0) 
  4129. GridsMinorX%) 
  4130. GridsMajorX% 
  4131. (GridsDash>0) 
  4132.  GridsGap>0 
  4133. startpath(GridsThick,128,GridsDash,GridsGap,0) 
  4134. startpath(GridsThick,0,0,0,0)
  4135. move(
  4136. Tx(x),
  4137. Ty(ScalingYMin)):
  4138. draw(
  4139. Tx(x),
  4140. Ty(ScalingYMax))
  4141. endpath
  4142.  ticks
  4143.  minors% 
  4144.  minor tick
  4145.  DrawFrame% 
  4146. TicksMajorXFrame% 
  4147. TicksMinorXFrame% 
  4148. (TicksMinorIn+TicksMinorOut>0) 
  4149.  do a frame tick
  4150. startpath(TicksMinorThick,0,0,0,0)
  4151. move(
  4152. Tx(x),
  4153. Ty(ScalingYMin)-TicksMinorOut):
  4154. draw(
  4155. Tx(x),
  4156. Ty(ScalingYMin)+TicksMinorIn)
  4157. endpath
  4158. startpath(TicksMinorThick,0,0,0,0)
  4159. move(
  4160. Tx(x),
  4161. Ty(ScalingYMax)+TicksMinorOut):
  4162. draw(
  4163. Tx(x),
  4164. Ty(ScalingYMax)-TicksMinorIn)
  4165. endpath
  4166.  DrawXAxis% 
  4167. TicksMajorXAxis% 
  4168. TicksMinorXAxis% 
  4169. (TicksMinorUp+TicksMinorDown>0) 
  4170.  do an x axis tick
  4171. startpath(TicksMinorThick,0,0,0,0)
  4172. move(
  4173. Tx(x),
  4174. Ty(ScalingYAtXAxis)-TicksMinorDown):
  4175. draw(
  4176. Tx(x),
  4177. Ty(ScalingYAtXAxis)+TicksMinorUp)
  4178. endpath
  4179.  major tick
  4180.  DrawFrame% 
  4181. TicksMajorXFrame% 
  4182. (TicksMajorIn+TicksMajorOut>0) 
  4183.  do a frame tick
  4184. startpath(TicksMajorThick,0,0,0,0)
  4185. move(
  4186. Tx(x),
  4187. Ty(ScalingYMin)-TicksMajorOut):
  4188. draw(
  4189. Tx(x),
  4190. Ty(ScalingYMin)+TicksMajorIn)
  4191. endpath
  4192. startpath(TicksMajorThick,0,0,0,0)
  4193. move(
  4194. Tx(x),
  4195. Ty(ScalingYMax)+TicksMajorOut):
  4196. draw(
  4197. Tx(x),
  4198. Ty(ScalingYMax)-TicksMajorIn)
  4199. endpath
  4200.  DrawXAxis% 
  4201. TicksMajorXAxis% 
  4202. (TicksMajorUp+TicksMajorDown>0) 
  4203.  do an x axis tick
  4204. startpath(TicksMajorThick,0,0,0,0)
  4205. move(
  4206. Tx(x),
  4207. Ty(ScalingYAtXAxis)-TicksMajorDown):
  4208. draw(
  4209. Tx(x),
  4210. Ty(ScalingYAtXAxis)+TicksMajorUp)
  4211. endpath
  4212. ((i% 
  4213.  minors%=0) 
  4214. LabelsXMinor%) 
  4215. ((DrawFrame% 
  4216. LabelsXFrame%) 
  4217. (DrawXAxis% 
  4218. LabelsXAxis%)) 
  4219.  do a label
  4220.  ex$="":ex = x
  4221.  suffix% 
  4222. (ex)>= 1.E12
  4223.    ex$="T":ex=ex*1.E-12
  4224. (ex)>= 1.E9
  4225.    ex$="G":ex=ex*1.E-9
  4226. (ex)>= 1.E6
  4227.    ex$="M":ex=ex*1.E-6
  4228. (ex)>=1.E3 
  4229.    ex$="k":ex=ex*1.E-3
  4230. TI @%=&A+(ScalingXDigits%<<8)+(ScalingXFormat%<<16)+(1<<24):i$=
  4231.  ex+ex$
  4232. labellength(i$)
  4233. (DrawFrame% 
  4234. LabelsXFrame%) 
  4235.  LabelsBelow% y=
  4236. Ty(ScalingYMin)-framedown-LabelsFontHeight*(1+LabelsXOffset) 
  4237. Ty(ScalingYMax)+frameup+LabelsFontHeight*LabelsXOffset
  4238. text(
  4239. Tx(x)-(x1+x2)/2,y,1,LabelsFontWidth,LabelsFontHeight,i$,0)
  4240. (DrawXAxis% 
  4241. LabelsXAxis%) 
  4242.  LabelsBelow% y=
  4243. Ty(ScalingYAtXAxis)-axisdown-LabelsFontHeight*(1+LabelsXOffset) 
  4244. Ty(ScalingYAtXAxis)+axisup+LabelsFontHeight*LabelsXOffset
  4245. text(
  4246. Tx(x)-(x1+x2)/2,y,1,LabelsFontWidth,LabelsFontHeight,i$,0)
  4247.  ScalingXLog% 
  4248.  ScalingXLogType% 
  4249.  mantissa%=5 mantissa%=1:exponent%+=1 
  4250.  mantissa%=2 mantissa%=5 
  4251.  mantissa%=2
  4252.  mantissa%=3 mantissa%=1:exponent%+=1 
  4253.  mantissa%=3
  4254. 2:exponent%+=1
  4255. 3:exponent%+=3
  4256. -1:mantissa%+=1:
  4257.  mantissa%=10 mantissa%=1:exponent%+=1
  4258.  x=mantissa%*10^exponent%
  4259.  i%=1:
  4260.  mantissa%=1 i%=0
  4261.  ScalingXLogType%=-1 
  4262.  mantissa%=1 
  4263.  mantissa%=2 
  4264.  mantissa%=5 i%=0 
  4265.  i%=1
  4266. m9 i%+=1:x=ScalingXAnchor+(i%-a%)*ScalingXMajor/minors%
  4267.  now update ready for axis text offset
  4268. q(i=LabelsFontHeight*(1+LabelsXOffset)
  4269.  DrawFrame% 
  4270. LabelsXFrame% 
  4271.  LabelsBelow% framedown+=i 
  4272.  frameup+=i
  4273.  DrawXAxis% 
  4274. LabelsXAxis% 
  4275.  LabelsBelow% axisdown+=i 
  4276.  axisup+=i
  4277. xtext
  4278.  x,y,x1,y1,x2,y2,n%,i$,j$,i%,j%
  4279. charcol%=FrameColour%
  4280. }-i$=AxistextXText$:n%=
  4281. Tcountbackslash(i$)
  4282.  i%=0 
  4283. i$,"\"):j$=i$:
  4284.  j% j$=
  4285. i$,j%-1):i$=
  4286. i$,j%+1)
  4287. textlength(j$):x=(
  4288. Tx(ScalingXMin)+
  4289. Tx(ScalingXMax)-x1-x2)/2
  4290. (DrawFrame% 
  4291. AxistextXFrame%) 
  4292.  AxistextBelow% y=
  4293. Ty(ScalingYMin)-framedown-AxistextFontHeight*(1+AxistextXOffset+i%*AxistextXSpacing) 
  4294. Ty(ScalingYMax)+frameup+AxistextFontHeight*(AxistextXOffset+(n%-i%)*AxistextXSpacing)
  4295. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,0)
  4296. (DrawXAxis% 
  4297. AxistextXFrame%) 
  4298.  AxistextBelow% y=
  4299. Ty(ScalingYAtXAxis)-axisdown-AxistextFontHeight*(1+AxistextXOffset+i%*AxistextXSpacing) 
  4300. Ty(ScalingYAtXAxis)+axisup+AxistextFontHeight*(AxistextXOffset+(n%-i%)*AxistextXSpacing)
  4301. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,0)
  4302. ymarks
  4303.  minors%,exponent%,m,mantissa%,x,y,i%,a%,i$,x1,y1,x2,y2,i,longest,rot%,ex,ex$
  4304.  variables for label offset control
  4305. =frameright=0:frameleft=0:axisright=0:axisleft=0:longest=0
  4306.  DrawFrame% 
  4307. TicksMajorYFrame% 
  4308. 5 frameright=TicksMajorOut:frameleft=TicksMajorOut
  4309.  TicksMinorYFrame% 
  4310. (TicksMinorOut>TicksMajorOut) frameright=TicksMinorOut:frameleft=TicksMinorOut
  4311.  DrawYAxis% 
  4312. TicksMajorYAxis% 
  4313. 6 axisright=TicksMajorRight:axisleft=TicksMajorLeft
  4314.  TicksMinorYAxis% 
  4315. (TicksMinorRight>TicksMajorRight) axisright=TicksMinorRight
  4316.  TicksMinorYAxis% 
  4317. (TicksMinorLeft>TicksMajorLeft) axisleft=TicksMinorLeft
  4318. 8rot%=0:
  4319.  LabelsYRotate% rot%=-1:
  4320.  LabelsLeft% rot%=1
  4321.  now prepare for loop
  4322.  ScalingYLog% 
  4323.  minors%=2
  4324. @ exponent%=
  4325. (ScalingYMin*0.999):m=ScalingYMin/10^exponent%
  4326.  ScalingYLogType% 
  4327. 0,-1:
  4328.  m>5 mantissa%=1:exponent%+=1 
  4329.  m>2 mantissa%=5 
  4330.  mantissa%=2
  4331.  m>3 mantissa%=1:exponent%+=1 
  4332.  mantissa%=3
  4333. 2:mantissa%=1:
  4334.  m>1 exponent%+=1
  4335. 3:mantissa%=1:
  4336.  m>1 exponent%+=1
  4337.  exponent% 
  4338. 3 exponent%+=1:
  4339.  exponent% 
  4340. 3 exponent%+=1
  4341.  y=mantissa%*10^exponent%
  4342.  i%=1:
  4343.  mantissa%=1 i%=0
  4344.  ScalingYLogType%=-1 
  4345.  mantissa%=1 
  4346.  mantissa%=2 
  4347.  mantissa%=5 i%=0 
  4348.  i%=1
  4349. 1 minors%=
  4350. (ScalingYMajor/ScalingYMinor+0.001)
  4351. e a%=0:
  4352.  ScalingYAnchor>ScalingYMin a%=minors%*
  4353. ((ScalingYAnchor-ScalingYMin)/ScalingYMajor+1.001)
  4354.  i%=-1
  4355. :i%+=1:y=ScalingYAnchor+(i%-a%)*ScalingYMajor/minors%:
  4356.  y>=ScalingYMin
  4357. linecol%=FrameColour%
  4358. charcol%=FrameColour%
  4359.  y<=ScalingYMax
  4360.  grids
  4361. ((i% 
  4362.  minors%=0) 
  4363. GridsMinorY%) 
  4364. GridsMajorY% 
  4365. (GridsDash>0) 
  4366.  GridsGap>0 
  4367. startpath(GridsThick,128,GridsDash,GridsGap,0) 
  4368. startpath(GridsThick,0,0,0,0)
  4369. move(
  4370. Tx(ScalingXMin),
  4371. Ty(y)):
  4372. draw(
  4373. Tx(ScalingXMax),
  4374. Ty(y))
  4375. endpath
  4376.  ticks
  4377.  minors% 
  4378.  minor tick
  4379.  DrawFrame% 
  4380. TicksMajorYFrame% 
  4381. TicksMinorYFrame% 
  4382. (TicksMinorIn+TicksMinorOut>0) 
  4383.  do a frame tick
  4384. startpath(TicksMinorThick,0,0,0,0)
  4385. move(
  4386. Tx(ScalingXMin)-TicksMinorOut,
  4387. Ty(y)):
  4388. draw(
  4389. Tx(ScalingXMin)+TicksMinorIn,
  4390. Ty(y))
  4391. endpath
  4392. startpath(TicksMinorThick,0,0,0,0)
  4393. move(
  4394. Tx(ScalingXMax)+TicksMinorOut,
  4395. Ty(y)):
  4396. draw(
  4397. Tx(ScalingXMax)-TicksMinorIn,
  4398. Ty(y))
  4399. endpath
  4400.  DrawYAxis% 
  4401. TicksMajorYAxis% 
  4402. TicksMinorYAxis% 
  4403. (TicksMinorLeft+TicksMinorRight>0) 
  4404.  do a y axis tick
  4405. startpath(TicksMinorThick,0,0,0,0)
  4406. move(
  4407. Tx(ScalingXAtYAxis)-TicksMinorLeft,
  4408. Ty(y)):
  4409. draw(
  4410. Tx(ScalingXAtYAxis)+TicksMinorRight,
  4411. Ty(y))
  4412. endpath
  4413.  major tick
  4414.  DrawFrame% 
  4415. TicksMajorYFrame% 
  4416. (TicksMajorIn+TicksMajorOut>0) 
  4417.  do a frame tick
  4418. startpath(TicksMajorThick,0,0,0,0)
  4419. move(
  4420. Tx(ScalingXMin)-TicksMajorOut,
  4421. Ty(y)):
  4422. draw(
  4423. Tx(ScalingXMin)+TicksMajorIn,
  4424. Ty(y))
  4425. endpath
  4426. startpath(TicksMajorThick,0,0,0,0)
  4427. move(
  4428. Tx(ScalingXMax)+TicksMajorOut,
  4429. Ty(y)):
  4430. draw(
  4431. Tx(ScalingXMax)-TicksMajorIn,
  4432. Ty(y))
  4433. endpath
  4434.  DrawYAxis% 
  4435. TicksMajorYAxis% 
  4436. (TicksMajorLeft+TicksMajorRight>0) 
  4437.  do a y axis tick
  4438. startpath(TicksMajorThick,0,0,0,0)
  4439. move(
  4440. Tx(ScalingXAtYAxis)-TicksMajorLeft,
  4441. Ty(y)):
  4442. draw(
  4443. Tx(ScalingXAtYAxis)+TicksMajorRight,
  4444. Ty(y))
  4445. endpath
  4446. ((i% 
  4447.  minors%=0) 
  4448. LabelsYMinor%) 
  4449. ((DrawFrame% 
  4450. LabelsYFrame%) 
  4451. (DrawYAxis% 
  4452. LabelsYAxis%)) 
  4453.  do a label
  4454.  ex$="":ex = y
  4455.  suffix% 
  4456. (ex)>= 1.E9
  4457.    ex$="G":ex=ex*1.E-9
  4458. (ex)>= 1.E6
  4459.    ex$="M":ex=ex*1.E-6
  4460. (ex)>=1.E3 
  4461.    ex$="k":ex=ex*1.E-3
  4462. I @%=&A+(ScalingYDigits%<<8)+(ScalingYFormat%<<16)+(1<<24):i$=
  4463.  ex+ex$
  4464. labellength(i$):
  4465. rotateboundingbox(rot%):
  4466.  x2-x1>longest longest=x2-x1
  4467. (DrawFrame% 
  4468. LabelsYFrame%) 
  4469.  LabelsLeft% x=
  4470. Tx(ScalingXMin)-frameleft-LabelsFontWidth*LabelsYOffset-x2 
  4471. Tx(ScalingXMax)+frameright+LabelsFontWidth*LabelsYOffset-x1
  4472. text(x,
  4473. Ty(y)-(y1+y2)/2,1,LabelsFontWidth,LabelsFontHeight,i$,rot%)
  4474. (DrawYAxis% 
  4475. LabelsYAxis%) 
  4476.  LabelsLeft% x=
  4477. Tx(ScalingXAtYAxis)-axisleft-LabelsFontWidth*LabelsYOffset-x2 
  4478. Tx(ScalingXAtYAxis)+axisright+LabelsFontWidth*LabelsYOffset-x1
  4479. text(x,
  4480. Ty(y)-(y1+y2)/2,1,LabelsFontWidth,LabelsFontHeight,i$,rot%)
  4481.  ScalingYLog% 
  4482.  ScalingYLogType% 
  4483.  mantissa%=5 mantissa%=1:exponent%+=1 
  4484.  mantissa%=2 mantissa%=5 
  4485.  mantissa%=2
  4486.  mantissa%=3 mantissa%=1:exponent%+=1 
  4487.  mantissa%=3
  4488. 2:exponent%+=1
  4489. 3:exponent%+=3
  4490. -1:mantissa%+=1:
  4491.  mantissa%=10 mantissa%=1:exponent%+=1
  4492.  y=mantissa%*10^exponent%
  4493.  i%=1:
  4494.  mantissa%=1 i%=0
  4495.  ScalingYLogType%=-1 
  4496.  mantissa%=1 
  4497.  mantissa%=2 
  4498.  mantissa%=5 i%=0 
  4499.  i%=1
  4500. 9 i%+=1:y=ScalingYAnchor+(i%-a%)*ScalingYMajor/minors%
  4501.  now update ready for axis text offset
  4502. +i=LabelsFontWidth*LabelsYOffset+longest
  4503.  rot% i=LabelsFontHeight*(1+LabelsYOffset)
  4504.  DrawFrame% 
  4505. LabelsYFrame% 
  4506.  LabelsLeft% frameleft+=i 
  4507.  frameright+=i
  4508.  DrawYAxis% 
  4509. LabelsYAxis% 
  4510.  LabelsLeft% axisleft+=i 
  4511.  axisright+=i
  4512. ytext
  4513.  x,y,x1,y1,x2,y2,n%,i$,j$,i%,j%,longest,rot%,meany,x0
  4514. charcol%=FrameColour%
  4515. ;rot%=0:
  4516.  AxistextRotate% rot%=-1:
  4517.  AxistextLeft% rot%=1
  4518. -i$=AxistextYText$:n%=
  4519. Tcountbackslash(i$)
  4520.  find the longest font-substring
  4521. longest=0:i%=
  4522. i$,"\"):j$=i$
  4523. textlength(
  4524. j$,i%-1)):
  4525.  x2-x1>longest longest=x2-x1
  4526. j$,i%+1):i%=
  4527. j$,"\")
  4528. textlength(
  4529. j$,i%-1)):
  4530.  x2-x1>longest longest=x2-x1
  4531.  now get on with it
  4532. /meany=(
  4533. Ty(ScalingYMin)+
  4534. Ty(ScalingYMax))/2
  4535.  i%=0 
  4536.  4j%=
  4537. i$,"\"):j$=i$:
  4538.  j% j$=
  4539. i$,j%-1):i$=
  4540. i$,j%+1)
  4541. textlength(j$):
  4542. rotateboundingbox(rot%)
  4543.  rot% 
  4544. $3 x0=longest/2+AxistextYOffset*AxistextFontWidth
  4545.  AxistextLeft% x0=-x0-(x1+x2)/2 
  4546.  x0=x0-(x1+x2)/2
  4547. &O y=meany-AxistextFontHeight/2+AxistextFontHeight*AxistextYSpacing*(n%/2-i%)
  4548. (F x0=-AxistextFontHeight*(AxistextYOffset+AxistextYSpacing*(n%-i%))
  4549.  y=meany-(y1+y2)/2
  4550. +E x0=AxistextFontHeight*(AxistextYOffset+AxistextYSpacing*(n%-i%))
  4551.  y=meany-(y1+y2)/2
  4552. (DrawFrame% 
  4553. AxistextYFrame%) 
  4554.  AxistextLeft% x=
  4555. Tx(ScalingXMin)-frameleft+x0 
  4556. Tx(ScalingXMax)+frameright+x0
  4557. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,rot%)
  4558. (DrawYAxis% 
  4559. AxistextYFrame%) 
  4560.  AxistextLeft% x=
  4561. Tx(ScalingXAtYAxis)-axisleft+x0 
  4562. Tx(ScalingXAtYAxis)+axisright+x0
  4563. text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,rot%)
  4564. labellength(i$)
  4565.  returns bounding box in points in x1,y1,x2,y2
  4566.  fonthandle%
  4567. "Font_FindFont",,FontsLabels$,16*LabelsFontWidth,16*LabelsFontHeight 
  4568.  fonthandle%
  4569. "Font_StringBBox",,i$ 
  4570. ,x1,y1,x2,y2
  4571. "Font_LoseFont",fonthandle%
  4572. ?/x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
  4573. textlength(i$)
  4574.  returns bounding box in points in x1,y1,x2,y2
  4575.  fonthandle%
  4576. "Font_FindFont",,FontsLabels$,16*AxistextFontWidth,16*AxistextFontHeight 
  4577.  fonthandle%
  4578. "Font_StringBBox",,i$ 
  4579. ,x1,y1,x2,y2
  4580. "Font_LoseFont",fonthandle%
  4581. H/x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
  4582. pointlength(y%)
  4583.  returns bounding box in points in x1,y1,x2,y2
  4584.  fonthandle%
  4585. "Font_FindFont",,FontsPoints$,16*ColumnWidth(y%),16*ColumnHeight(y%) 
  4586. fonthandle%
  4587. "Font_CharBBox",fonthandle%,ColumnChar%(y%),0 
  4588. ,x1,y1,x2,y2
  4589. "Font_LoseFont",fonthandle%
  4590. Q/x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
  4591. rotateboundingbox(rot%)
  4592.  rot% 
  4593.  rotate anticlockwise
  4594. X" i=x1:x1=-y2:y2=x2:x2=-y1:y1=i
  4595.  rotate clockwise
  4596. Z" i=x1:x1=y1:y1=-x2:x2=y2:y2=-i
  4597. Tcountbackslash(i$)
  4598.  i%,n%
  4599. n%=0:i%=
  4600. i$,"\")
  4601. (i%>0) 
  4602. (i$<>"")
  4603. b"n%+=1:i$=
  4604. i$,i%+1):i%=
  4605. i$,"\")
  4606. graphkey
  4607.  x,y,i%,width,style%,on,off,s,h,w,i$,fonthandle%,x1%,y1%,x2%,y2%,yo,wo
  4608. hMx=GraphKeyLeft*pointsininch%:y=GraphKeyTop*pointsininch%-LabelsFontHeight
  4609. s=LabelsFontHeight
  4610.  i%=0 
  4611. ColumnMeaning$(i%),1)="Y") 
  4612. ColumnPlot%(i%) 
  4613. ColumnHeight(i%)>s s=ColumnHeight(i%)
  4614. :s=1.2*s
  4615.  work out rectangle sizing first
  4616.  i%=0 
  4617. ColumnMeaning$(i%),1)="Y") 
  4618. ColumnPlot%(i%) 
  4619. drawn%(i%) 
  4620. r+ i$=ColumnKeyText$(i%):
  4621. labellength(i$)
  4622.  wo < x2-x1 wo = x2-x1
  4623. w-charcol%=KeyOutline%:linecol%=KeyOutline%
  4624.  wo > 0 
  4625.  add in rectangle
  4626. wo+=72+LabelsFontWidth
  4627. startpathfill(linecol%,FrameThick,KeyBack%)
  4628. move(x-18,yo+s):
  4629. draw(x-18+wo,yo+s):
  4630. draw(x-18+wo,y+s/2):
  4631. draw(x-18,y+s/2)
  4632. closesubpath
  4633. endpath
  4634.  i%=0 
  4635. ColumnMeaning$(i%),1)="Y") 
  4636. ColumnPlot%(i%) 
  4637. drawn%(i%) 
  4638.  ColumnPoints%(i%) 
  4639. ?  h=ColumnHeight(i%):w=ColumnWidth(i%):i$=
  4640.  ColumnChar%(i%)
  4641. pointlength(i%)
  4642. !  charcol%=ColumnCharcol%(i%)
  4643. text(x+18-(x1+x2)/2,y+s/3-(y1+y2)/2,2,w,h,i$,0)
  4644.   charcol%=black%
  4645.  ColumnLine%(i%) 
  4646. !  linecol%=ColumnLinecol%(i%)
  4647. o  width=ColumnThick(i%):style%=0:on=ColumnDash(i%):off=ColumnGap(i%):on2=ColumnDash2(i%):
  4648.  off>0 style%=128
  4649.  on>0 linecol%=ColumnLinecol%(i%):
  4650. startpath(width,style%,on,off,on2):
  4651. move(x,y+s/3):
  4652. draw(x+36,y+s/3):
  4653. endpath:linecol%=black%
  4654. + i$=ColumnKeyText$(i%):
  4655. labellength(i$)
  4656. text(x+36+LabelsFontWidth,y+s/2-LabelsFontHeight/2,1,LabelsFontWidth,LabelsFontHeight,i$,0)
  4657. startpathfill(colour%,width,fill%)
  4658. word(2)
  4659.  memory% pathheader%=ptr% 
  4660.  pathheader%=
  4661. word(0):
  4662. coord(0,0):
  4663. coord(1,1)
  4664. word(fill%):
  4665.  fill colour given by fill%
  4666. word(colour%)
  4667. word(width*point%):
  4668. word(0)
  4669. local%=
  4670. text(x,y,font%,w,h,i$,rot%)
  4671.  assumes bounding box given by x1,y1,x2,y2;text colour is charcol%
  4672.  j%,w%,k%
  4673.  rot% 
  4674. word(12)
  4675. word(13*4+4+4*(
  4676. 4)+28)
  4677. bound(x+x1,y+y1,x+x2,y+y2)
  4678. word(0):
  4679. word(rot%*&10000)
  4680. word(-rot%*&10000):
  4681. word(0)
  4682. word(0):
  4683. word(0)
  4684. word(0)
  4685. word(1)
  4686. word(13*4+4+4*(
  4687. bound(x+x1,y+y1,x+x2,y+y2)
  4688. word(charcol%):
  4689.  coloured text
  4690. word(white%):
  4691.  white background
  4692. word(font%)
  4693. coord(w*point,h*point):
  4694. coord(x*point,y*point)
  4695.  j%=0 
  4696.  k%=0 
  4697.  j%+k%<
  4698.  i$ w%+=((
  4699. i$,1+j%+k%,1))<<(8*k%))
  4700. word(w%)
  4701. xaxis
  4702. linecol%=FrameColour%
  4703. startpath(AxisThick,0,0,0,0)
  4704. move(
  4705. Tx(ScalingXMin),
  4706. Ty(ScalingYAtXAxis))
  4707. draw(
  4708. Tx(ScalingXMax),
  4709. Ty(ScalingYAtXAxis))
  4710. endpath
  4711. yaxis
  4712. linecol%=FrameColour%
  4713. startpath(AxisThick,0,0,0,0)
  4714. move(
  4715. Tx(ScalingXAtYAxis),
  4716. Ty(ScalingYMin))
  4717. draw(
  4718. Tx(ScalingXAtYAxis),
  4719. Ty(ScalingYMax))
  4720. endpath
  4721. frame
  4722. linecol%=FrameColour%
  4723. startpath(FrameThick,0,0,0,0)
  4724. move(
  4725. Tx(ScalingXMin),
  4726. Ty(ScalingYMin))
  4727. draw(
  4728. Tx(ScalingXMax),
  4729. Ty(ScalingYMin))
  4730. draw(
  4731. Tx(ScalingXMax),
  4732. Ty(ScalingYMax))
  4733. draw(
  4734. Tx(ScalingXMin),
  4735. Ty(ScalingYMax))
  4736. closesubpath
  4737. endpath
  4738. fillback
  4739. startpathfill(-1,0,FrameFillColour%)
  4740. move(
  4741. Tx(ScalingXMin),
  4742. Ty(ScalingYMin))
  4743. draw(
  4744. Tx(ScalingXMax),
  4745. Ty(ScalingYMin))
  4746. draw(
  4747. Tx(ScalingXMax),
  4748. Ty(ScalingYMax))
  4749. draw(
  4750. Tx(ScalingXMin),
  4751. Ty(ScalingYMax))
  4752. closesubpath
  4753. endpath
  4754. border
  4755. linecol%=black%
  4756. startpath(0,0,0,0,0)
  4757. move(GraphBorderLeft*pointsininch%,GraphBorderBottom*pointsininch%)
  4758. draw((GraphBorderLeft+GraphBorderWidth)*pointsininch%,GraphBorderBottom*pointsininch%)
  4759. draw((GraphBorderLeft+GraphBorderWidth)*pointsininch%,(GraphBorderBottom+GraphBorderHeight)*pointsininch%)
  4760. draw(GraphBorderLeft*pointsininch%,(GraphBorderBottom+GraphBorderHeight)*pointsininch%)
  4761. closesubpath
  4762. endpath
  4763. Tx(x):
  4764.  in points
  4765.  offset
  4766.  ScalingXLog% 
  4767. = offset=(
  4768.  ScalingXMin)/(
  4769.  ScalingXMax-
  4770.  ScalingXMin)
  4771. 5 offset=(x-ScalingXMin)/(ScalingXMax-ScalingXMin)
  4772.  offset is between 0 and 1 if within the frame
  4773. <=GraphLeft*pointsininch%+GraphWidth*pointsininch%*offset
  4774. Ty(y):
  4775.  in points
  4776.  offset
  4777.  ScalingYLog% 
  4778. = offset=(
  4779.  ScalingYMin)/(
  4780.  ScalingYMax-
  4781.  ScalingYMin)
  4782. 5 offset=(y-ScalingYMin)/(ScalingYMax-ScalingYMin)
  4783.  offset is between 0 and 1 if within the frame
  4784. ?=GraphBottom*pointsininch%+GraphHeight*pointsininch%*offset
  4785. startpath(width,style%,on,off,on2)
  4786. word(2)
  4787.  memory% pathheader%=ptr% 
  4788.  pathheader%=
  4789. word(0):
  4790. coord(0,0):
  4791. coord(1,1)
  4792. word(-1):
  4793.  fill colour = no fill
  4794. word(linecol%):
  4795.  line colour = linecol%
  4796. word(width*point):
  4797. word(style%)
  4798. (style% 
  4799. 128) 
  4800.  on2>0 
  4801. word(0):
  4802. word(4)
  4803. word(on*point):
  4804. word(off*point)
  4805. word(on2*point):
  4806. word(off*point)
  4807. word(0):
  4808. word(2)
  4809. word(on*point):
  4810. word(off*point)
  4811. local%=
  4812. Treadpalette(fill%)
  4813. "Wimp_ReadPalette",,block%
  4814. $r%=(block%!(4*fill%)) 
  4815. &F0F0F000
  4816.  (r%>>>4)
  4817. move(x,y)
  4818. word(2)
  4819. coord(x*point,y*point)
  4820. updatelocal(x,y)
  4821. draw(x,y)
  4822. word(8)
  4823. coord(x*point,y*point)
  4824. updatelocal(x,y)
  4825. closesubpath
  4826. word(5)
  4827. endpath
  4828. word(0)
  4829.  memory% end%=ptr%:ptr%=pathheader% 
  4830.  end%=
  4831. #c%=pathheader%
  4832. word(end%-pathheader%+4)
  4833.  local% 
  4834. coord((localxmin-1)*point,(localymin-1)*point)
  4835. coord((localxmax+1)*point,(localymax+1)*point)
  4836. updateglobal(localxmin,localymin,localxmax,localymax)
  4837.  memory% 
  4838.  ptr%=end% 
  4839. #c%=end%
  4840. updatelocal(x,y)
  4841.  in points
  4842.  local% 
  4843.  x<localxmin localxmin=x
  4844.  y<localymin localymin=y
  4845.  x>localxmax localxmax=x
  4846.  y>localymax localymax=y
  4847.  localxmin=x:localxmax=x
  4848.  localymin=y:localymax=y
  4849.  local%=
  4850. updateglobal(xmin,ymin,xmax,ymax)
  4851.  in points
  4852.  global% 
  4853.  xmin<globalxmin globalxmin=xmin
  4854.  ymin<globalymin globalymin=ymin
  4855.  xmax>globalxmax globalxmax=xmax
  4856.  ymax>globalymax globalymax=ymax
  4857. M$ globalxmin=xmin:globalxmax=xmax
  4858. N$ globalymin=ymin:globalymax=ymax
  4859.  global%=
  4860. startdrawfile
  4861. word(&77617244):
  4862. word(201):
  4863. word(0)
  4864. twelve("Tau")
  4865.  memory% fileheader%=ptr% 
  4866.  fileheader%=
  4867. coord(0,0)
  4868. coord(1,1)
  4869. global%=
  4870. fonttable
  4871.  fontdata$,length%,i%,b%,j%
  4872. ^3fontdata$=
  4873. 1+FontsLabels$+
  4874. 2+FontsPoints$+
  4875. _+fontdata$+=
  4876.  fontdata$ 
  4877. length%=
  4878.  fontdata$
  4879. word(0):
  4880. word(8+length%)
  4881.  i%=0 
  4882. length%-4 
  4883. c8b%=0:
  4884.  j%=0 
  4885. 3:b%+=
  4886. fontdata$,1+i%+j%,1)<<(8*j%):
  4887. word(b%)
  4888. enddrawfile
  4889. global% 
  4890.  memory% end%=ptr%:ptr%=fileheader% 
  4891.  end%=
  4892. #c%=fileheader%
  4893. coord((globalxmin-1)*point,(globalymin-1)*point)
  4894. coord((globalxmax+1)*point,(globalymax+1)*point)
  4895.  memory% ptr%=end% 
  4896. #c%=end%
  4897. startgroup(grouplevel%)
  4898. word(6)
  4899.  memory% groupheader%(grouplevel%)=ptr% 
  4900.  groupheader%(grouplevel%)=
  4901. word(0):
  4902. coord(0,0):
  4903. coord(1,1)
  4904. twelve("")
  4905. endgroup(grouplevel%)
  4906.  memory% end%=ptr%:ptr%=groupheader%(grouplevel%) 
  4907.  end%=
  4908. #c%=groupheader%(grouplevel%)
  4909. word(end%-groupheader%(grouplevel%)+4)
  4910.  memory% ptr%=end% 
  4911. #c%=end%
  4912. boundgroups
  4913.  memory% end%=ptr% 
  4914.  end%=
  4915. boundgroup(1)
  4916.  GraphBorder% 
  4917. GraphKey% 
  4918. boundgroup(2)
  4919.  GraphKey% 
  4920. boundgroup(3)
  4921.  memory% ptr%=end% 
  4922. #c%=end%
  4923. boundgroup(grouplevel%)
  4924.  memory% ptr%=groupheader%(grouplevel%)+4 
  4925. #c%=groupheader%(grouplevel%)+4
  4926. coord((globalxmin-1)*point,(globalymin-1)*point)
  4927. coord((globalxmax+1)*point,(globalymax+1)*point)
  4928. word(i%)
  4929.  memory% 
  4930.  overflow% 
  4931.  Himem%!ptr%=i%
  4932. 6 ptr%+=4:
  4933.  ptr%>buffer%-16 overflow%=
  4934. Tcheckmemory
  4935. #c%,i% 
  4936. #c%,(i%>>>8) 
  4937. #c%,(i%>>>16) 
  4938. #c%,(i%>>>24) 
  4939. twelve(i$)
  4940. i$+"            ",12)
  4941.  memory% 
  4942.  overflow% 
  4943.  $(Himem%+ptr%)=i$
  4944. 7 ptr%+=12:
  4945.  ptr%>buffer%-16 overflow%=
  4946. Tcheckmemory
  4947.  i%=1 
  4948. i$,i%,1)
  4949. Tcheckmemory
  4950. buffer%+=32*1024
  4951. "Wimp_SlotSize",MinSlotSize%+buffer%,-1 
  4952.  newsize%
  4953.  newsize%<>MinSlotSize%+buffer% =
  4954. coord(x%,y%)
  4955. word(x%):
  4956. word(y%)
  4957. bound(x1,y1,x2,y2)
  4958.  never use this PROC with dummy values !!!
  4959. coord(x1*point,y1*point)
  4960. coord(x2*point,y2*point)
  4961. updateglobal(x1,y1,x2,y2)
  4962. setthestyle(i%)
  4963. handle%=columnhandle%
  4964. setwritablestring(47,style$(i%))
  4965. Qg%(8)=
  4966. :g%(9)=
  4967. :g%(45)=
  4968. setwritablestring(45,"0"):
  4969. setwritablestring(9,"0")
  4970. 7g%(8)=
  4971. :g%(9)=
  4972. :g%(45)=
  4973. setwritablestring(45,"0")
  4974. Tgetwritable(9):
  4975.  x%=0 
  4976. setwritablestring(9,"6")
  4977. g%(8)=
  4978. :g%(9)=
  4979. :g%(45)=
  4980. Tgetwritable(9):
  4981.  x%=0 
  4982. setwritablestring(9,"6")
  4983. Tgetwritable(45):
  4984.  x%=0 
  4985. setwritablestring(45,"2")
  4986. setgrey(8,g%(8))
  4987. setgrey(9,g%(9))
  4988. setgrey(45,g%(45))
  4989. setgrey(icon%,state%)
  4990.  if state% TRUE, ungreyed, else greyed; always unselected
  4991. +!block1%=handle%:block1%!12=sel% 
  4992. grey%
  4993. block1%!4=icon%
  4994.  state% block1%!8=0 
  4995.  block1%!8=grey%
  4996. "Wimp_SetIconState",,block1%
  4997. pkiedit
  4998.  r%,c%,a$,b$,a,b,s%,ch%
  4999. handle%=edithandle%
  5000.     ch%=
  5001. Tgetwritablestring(3)
  5002. Tgetwritablestring(5)
  5003. closewindow(edithandle%)
  5004.  a$="" 
  5005. report("No value to change!"):
  5006. "Wimp_CreateMenu",,-1:
  5007. b$)=" " b$=
  5008. (b$)-1):
  5009.  ".","":
  5010. b=0:s%=0
  5011.  "m","M":
  5012. b=0:s%=2
  5013. (b$):s%=1
  5014.  r%=0 
  5015.  maxrow%
  5016.  c%=0 
  5017.  maxcolumn%
  5018. Tdata(c%,r%)=a 
  5019.  ch%=
  5020. data(c%,r%,b)
  5021.  DataStatus%?(c%+C1%*r%)=s%
  5022.  ch% 
  5023.  ScalingAuto% 
  5024. autoscale
  5025. update(mainhandle%)
  5026. "Wimp_CreateMenu",,-1
  5027. opencolour(t$,colour%,icon%,type%)
  5028. !colourpick%=0
  5029. colourpick%!4=colourtitle%
  5030. $colourtitle%=t$
  5031. colourpick%!8=x%
  5032. 5colourpick%!12=&80000000:colourpick%!16=&7FFFFFFF
  5033. colourpick%!20=y%
  5034. %colourpick%!24=0:colourpick%!28=0
  5035. colourpick%!32=colour%
  5036. colourpick%!36=0
  5037.  "ColourPicker_OpenDialogue",type%,colourpick% 
  5038.  dialogue%,colourhandle%
  5039. setupsprites
  5040.  spritearea% 700
  5041. !spritearea%=700
  5042. spritearea%!4=0
  5043. spritearea%!8=16
  5044. spritearea%!12=0
  5045.  &2E,256+9,spritearea%
  5046.  &2E,256+10,spritearea%,"<Tau$Dir>.Sprites"
  5047.  &2E,256+37,spritearea%,"fill",-1 
  5048.  ,,,,filladdress%
  5049.  &2E,256+37,spritearea%,"line",-1 
  5050.  ,,,,lineaddress%
  5051.  &2E,256+37,spritearea%,"char",-1 
  5052.  ,,,,charaddress%
  5053. setcolour(handle%,ih%,col%,sprname$)
  5054.  address%
  5055.  sprname$ 
  5056.  "fill":address%=filladdress%
  5057.  "line":address%=lineaddress%
  5058.  "char":address%=charaddress%
  5059. !address%=col%
  5060. <block1%!0=handle%:block1%!4=ih%:block1%!8=0:block1%!12=0
  5061.  "Wimp_SetIconState",,block1%
  5062. setgrey(ih%,
  5063. setgreycolour(handle%,ih%,sprname$)
  5064. setcolour(handle%,ih%,mgrey%,sprname$)
  5065. setgrey(ih%,
  5066. TgetSelwyn
  5067.  A%=0 
  5068. "Font_FindFont",,"Selwyn",16*12,16*12 
  5069.